Notorious Preying Mantis

    springbokjs-router

    3.5.0 • Public • Published

    springbokjs-router NPM version Build Status Coverage

    browser support

    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

    Keywords

    Install

    npm i springbokjs-router

    DownloadsWeekly Downloads

    3

    Version

    3.5.0

    License

    MIT

    Last publish

    Collaborators

    • churpeau