A minimalistic route parser for nation powered by (path-to-regexp
)[https://github.com/pillarjs/path-match].
- Tiny
- Fast
- Really easy to use
$ npm install nation-routes
const nationRoutes = require('nation-routes');
const route = nationRoutes('/route/:id');
const match = route(url);
if (match == false) {
// no match
} else {
const id = match.id;
}
Type: string
The route to match.
Return false
if there was no match or an object with the params if the routes matched.
Type: string
The url to match with the route