express-routescan icon indicating copy to clipboard operation
express-routescan copied to clipboard

Add folder name to route

Open udayms opened this issue 8 years ago • 1 comments

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... :)

udayms avatar Apr 30 '16 02:04 udayms

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

johannlo avatar May 12 '17 08:05 johannlo