UNPKG

nation-routes

Version:

Minimalistic route parser for nation

55 lines (33 loc) 726 B
# 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 ```js 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 MIT © [](http://tobihrbr.com)