You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking an option to add a prefix with the locale on all the route except for public.
I can do this but it include public
app.use('/:locale',kraken(options));
I created a folder called ":locale" to use like a dynamic and it works for the controller but doesn't detect the parameter.
I thought it was because my middleware is before the router but doesn't work if I try on the final function and is undefined. (Update: I can use the parameter on the final route if I add mergeParams: true.)
/controller/:locale/index.js
Now I am trying just one file: controller/index.js where I included all the routes and I set the param :locale on all of them. router.get('/:locale/home', function (req, res) { ... }
I think these are the most "clean" options that I found.
I like the first but include the public resources.
The option two is good but I don't know how flexible is the controller tree to create dynamic parameters
Could you tell me which is the best way and if there any way to exclude the public folder please?
Also I would like check the :locale param on a middleware but req.params is undefined except for the option 1. Is any way to do it on the another options?
Many thanks!!!
The text was updated successfully, but these errors were encountered:
Hello,
I am looking an option to add a prefix with the locale on all the route except for public.
I can do this but it include public
app.use('/:locale',kraken(options));
I created a folder called ":locale" to use like a dynamic and it works for the controller but doesn't detect the parameter.
I thought it was because my middleware is before the router but doesn't work if I try on the final function and is undefined. (Update: I can use the parameter on the final route if I add mergeParams: true.)
/controller/:locale/index.js
router.get('/:locale/home', function (req, res) { ... }
I think these are the most "clean" options that I found.
I like the first but include the public resources.
The option two is good but I don't know how flexible is the controller tree to create dynamic parameters
Could you tell me which is the best way and if there any way to exclude the public folder please?
Also I would like check the :locale param on a middleware but req.params is undefined except for the option 1. Is any way to do it on the another options?
Many thanks!!!
The text was updated successfully, but these errors were encountered: