1.0.0 • Published 6 years ago
nation-routes v1.0.0
nation-routes
A minimalistic route parser for nation powered by (path-to-regexp
)https://github.com/pillarjs/path-match.
Features
- Tiny
- Fast
- Really easy to use
Install
$ npm install nation-routes
Usage
const nationRoutes = require('nation-routes');
const route = nationRoutes('/route/:id');
const match = route(url);
if (match == false) {
// no match
} else {
const id = match.id;
}
API
nationRoutes(route)
route
Type: string
The route to match.
match(url)
Return false
if there was no match or an object with the params if the routes matched.
url
Type: string
The url to match with the route
License
1.0.0
6 years ago