modweb-router

1.2.1 • Public • Published

modweb-router

Object based router with Express-style route format.

Example

var Router = require("modweb-router");

var pages = [
	{
		href: "/test",
		routes: [ "/test-:year/:page" ],
		custom: "data"
	}
];

var router = new Router(pages);

var page = router.resolve("/test-2016/5");

console.log(page);

Outputs:

{ page:
   { href: '/test',
     routes: [ '/test-:year/:page' ],
     custom: 'data' },
  params: { year: '2016', page: '5' } }

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i modweb-router

Weekly Downloads

1

Version

1.2.1

License

MIT

Last publish

Collaborators

  • mderijcke