express-accept-version
v1.0.2
Published
Parsing Accept-Version on expressjs
Downloads
1
Maintainers
Readme
express-accept-version
Parsing Accept-Version
on expressjs
express-accept-version
supported semver version
Support platforms
The express-accept-version
module works with Node.js v0.10.x and later version too.
Installation
$ npm install express-accept-version
Usage
const express = require('express'),
acceptVersion = require('express-accept-version');
let app = express();
app.use(acceptVersion([versions]); // [versions] is your server supported version, Allow type : Array, String
app.get('/', (req, res, next) => {
switch(req.acceptVersion) { // req.acceptVersion is client maximum Accept-Version
case '1.0.0':
// 1.0.0 logic
break;
default:
// latest logic
break;
}
});