require absolute
This commit is contained in:
parent
810d8107ae
commit
6d6dfe1991
5
index.js
5
index.js
@ -1,4 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* Load all request handlers in the given folder
|
||||
@ -17,9 +18,7 @@ module.exports = function (app, modulefolder, opts) {
|
||||
.replace(/\./g, '/')
|
||||
.replace(/\/+/g, '/');
|
||||
|
||||
const handler = require(('./' + modulefolder + '/' + f)
|
||||
.replace(/\/\.\//g, '/')
|
||||
.replace(/\/+/g, '/'));
|
||||
const handler = require(path.join(process.cwd(), modulefolder, f));
|
||||
const func = (req, res, next) => {
|
||||
handler(req, res, next, opts);
|
||||
};
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "requestor",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scode/requestor",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "Split express paths into individual files to make api programming more structured",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Reference in New Issue
Block a user