1.0.1 • Published 6 years ago
rtd-core v1.0.1
rtd-core
A minimalistic route parser for rtd
powered by path-to-regexp
.
Features
- Tiny
- Fast
- Really easy to use
Install
$ npm install rtd-core
Usage
const rtdCore = require('rtd-core');
const route = rtdCore('/route/:id');
const match = route(url);
if (match == false) {
// no match
} else {
const id = match.id;
}
API
rtdCore(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