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