micro-test-route
v0.2.0
Published
A simple url test utility for micro based on nblackburn/micro-match
Downloads
3
Readme
micro test
A simple url testing utility for micro.
Installation
To install micro test, simply run the following command in your package manager.
yarn add micro-test-route
npm install -g micro-test-route
Once you have installed micro test, simply include it in your project like so...
const test = require('micro-test-route');
Usage
micro test exposes a single method which allows you to test a route to it's real world counterpart.
const isUserIdRoute = test('/users/:id', '/users/1');
Parameters are defined as a comma followed by an alias to bind it's value to.
You can also create optional parameters by attaching a ?
suffix. This will allow both /users
and /users/1
to be matched.
Now you will be able to access the id
parameter with the value of 1
and handle it however ever you like.
License
This utility is licensed under MIT, see LICENSE.md for details.
Support Nathaniel Blackburn
This utility is 95% based on the Nathaniel Blackburn work !
Donations
If you found this utility to be useful, please consider donating.
Beerpay
Hey dude! Help me out for a couple of :beers:!