========
Mojito is currently rewriting how routes are configured. Routes data is currently shared between server and client runtime.
Mojito will provide a BC layer, if required, in order to minimise inadverse effects on applications.
========
In the next revision of Mojito, the underlying routing mechanism will be changed to be in line with how Express does routing.
This change will have the following effects:
routes.jsonwill no longer be the only way routes can be setup, and in fact, it will be reimplemented to besugaron top of the core implementation.- the internal data structure for
routeswill be affected, and will be in line with more how Express store routes, plus some specific Mojito annotations. - routes will no longer be contextualized in the
routes.jsonway. contextualization can still be achieved, but that responsibility now moves to the application layer. - deprecation of routes related APIs
WHY ?
Express has already done all the work at the routing later to setup the routes data, and there is absolutely no reason for Mojito to recompute the routes data and store it into a format that is different from Express.
========
ResourceStore.getRoutes(ctx)is now deprecated.- Routes data are no longer contextualized.
- The correct way for the application to retrieve routes data is via the
mojitoinstance, which is available on theappinstance from Express. e.g. at runtime,req.app.mojito.routes - In the future, there might be a sugar accessor to retrieve the
routesdata, but the master copy will be attached to thereq.app.mojitoinstance.
- The internal route object structure will be changed to be in line with Express.
========
applications making use of the following APIs might be affected:
ac.url.make()andac.url.find(). Indirectly, the underlying implementation is also affected, namelyY.mojito.RouteMaker(). Hopefully applications is accessing routes metadata via theac.url.*addon.Y.mojito.ResourceStore.getRoutes(ctx)Y.mojito.RouteMaker.make()andY.mojito.RouteMaker.find()
Search for the following to find out if the app is affected:
- ac.url.*
- make()
- find()
- RouteMaker
- getComputedRoutes()
- make()
- find()
- ResourceStore
- getRoutes(ctx)
// e.g. in mojito-shaker
addons/ac/shaker.server.js
29: data.route = ac.url.find(adapter.req.url, adapter.req.method);
========
Ideally, Mojito would like to start with a clean slate and use the new route structure for sharing routes data between server and client runtime.
We would like to get more details as to how Search app:
- is affected by the above API changes, and if so
- how is the app using the
routesdata to access properties likepath,call, etc etc