express-routescan
express-routescan copied to clipboard
Add folder name to route
I realize theres been no code committed into this repo in the last couple of years. I really loved the way routescan handles the routes. I am just curios, if the routescan automatically picks up the folder name and adds it as a context to the routes defined in it? For example?
If the routes in routes/user.js are defined as '/signup' and '/signin'.... this will be treated as http://server/signup and http://server/signin ....... if the file user.js is put inside the folder security.... i.e. routes/security/user.js .... the new routes should automatically be http://server/security/signup and http://server/security/signin. The folder in which the route is defined gets treated as part of the route and sets the context to the routes.
For example: https://github.com/stonecircle/express-autoroute does this part of it... I just like routescan in terms of everything else... :)
i'm looking for this feature too.
I'm still figuring out how do i attach a base URL to all my routes using routescan.
I want to achieve this /base/url1 /base/url2 /base/url3
module.exports = { '/base':{ methods: ['use'], fn:function(req,res,next){ next(); } },
'/url1': { methods: ['post'], fn: function (req, res) { ---something goes here------ } },
but that doesn't seem to work. routescan still initialize it as POST /url1