README
restify-url-semver-parser
Extract version number from URL and adds this number as the value for request 'accept-version' header.
Install
npm i restify-url-semver-parser -S
Usage
Import package:
const restifyUrlSemverParser = require('restify-url-semver-parser');
Apply plugin:
const server = restify.createServer();
server.pre(restifyUrlSemverParser);
Define route:
server.get({ path: '/', version: '1.2.3' }, (req, res, next) => {
// Route implementation
});
Use semantic versioning: MAJOR.MINOR.PATCH
Example:
- http:example.com/v1.0.0/foo
- http:example.com/v1.0.0-alpha/foo
- http:example.com/v1.0.0-alpha+001/foo
The lowercase v
as used in examples above is required.
License
MIT