This PR introduces localized URLs, such as /en/start or /fr/debut
Fixes #58.
We introduce a new method to routes, .draw(app), which returns a DrawRoutes object. This object has methods .get(...), .post(...), .put(...) and .delete(...), as well as a generic .request(methodName, ...) to register paths to the app object. Notably, these methods do not receive a path parameter - instead, we will draw paths for all locales, using the path names in config/routes.config.js. We also insert a middleware which sets the locale, so the correct locale is available within the handler and all subsequent middleware.
BREAKING: route.path now returns an object, such as { en: '/en/personal', fr: '/fr/personnel' }. This will likely break code that relies on route.path being a string.
This pull request introduces 1 alert when merging 4857db362ed385e414aef2d1150819c3a3f735e6 into 918f143cb43acc63ade70c48a6b3750c6ae18184 - view on LGTM.com
This PR introduces localized URLs, such as
/en/start
or/fr/debut
Fixes #58.
We introduce a new method to routes,
.draw(app)
, which returns aDrawRoutes
object. This object has methods.get(...)
,.post(...)
,.put(...)
and.delete(...)
, as well as a generic.request(methodName, ...)
to register paths to the app object. Notably, these methods do not receive a path parameter - instead, we will draw paths for all locales, using the path names inconfig/routes.config.js
. We also insert a middleware which sets the locale, so the correct locale is available within the handler and all subsequent middleware.BREAKING:
route.path
now returns an object, such as{ en: '/en/personal', fr: '/fr/personnel' }
. This will likely break code that relies onroute.path
being a string.