springbokjs-router
v3.5.0
Published
SpringbokJS Router
Downloads
14
Readme
springbokjs-router
See the auto-generated docs
How to use
var SpringbokRouter = require('springbokjs-router');
var RouterBuilder = SpringbokRouter.RouterBuilder;
var RoutesTranslations = SpringbokRouter.RoutesTranslations;
var routesLangs = {
login: {
en: 'login',
fr: 'connexion'
},
post: {
en: 'post',
fr: 'article'
},
'view': {
en: 'view',
fr: 'afficher'
}
};
var routesTranslations = new RoutesTranslations(routesLangs);
var builder = new RouterBuilder(routesTranslations, ['en', 'fr']);
module.exports = builder.router;
builder
.add('/', '/', 'site.index')
.add('postView', '/post/:id-:slug', 'post.view', {
namedParamsDefinition: {'slug': '[A-Za-z\-]+'},
extension: 'htm'
})
.addDefaultRoutes();
Missing before 1.0.0:
- better handle of array to route : RouterRouteLang.strf is not ideal. Especially with routes like '.../*' or route with optional parts