Skip to content

Vatican.requestHandler #23

@smart--petea

Description

@smart--petea

In Vatican.requestHandler there is the snippet

var hdlr = this.loadHandler(process.cwd() + "/" + methodFound.handlerPath)

If options.handlers is defined as relative path all it's ok. If options.handlers is defined as absolute paths the methodFound.handlerPath is an absolute path and the expression process.cwd() + "/" + methodFound.handlerPath will give something like

/home/ppp//home/ppp/tt/dd

plus an error of reading the directory.

Maybe

  1. to import path module
  2. rewrite function Vatican.parseHandlers
Vatican.prototype.parseHandlers = function(cb) {
  ...
  var dir = path.isAbsolute(this.options.handlers) ? this.options.handlers : process.cwd() + "/" + this.options.handlers;
  ...
}
  1. rewrite Vatican.requestHandler
Vatican.prototype.requestHandler = function(req, res) {
...
var hdlr = this.loadHandler( methodFound.handlerPath)
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions