1.0.0 • Published 7 years ago
express-accepts-exact v1.0.0
express-accepts-exact
Simple express middleware for filtering routes by exact matches of Accepts header.
Installation
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
$ npm install express-accepts-exact --save
Example
app.get("/api/custom-download/:file", require("express-accepts-exact")("application/vnd.mydomain.custom"), getFile);
let acceptExact = require("express-accepts-exact");
app.get("/api/custom-download/:file", acceptExact(["application/vnd.mydomain.custom", "plain/text"]), getFile);
let acceptExact = require("express-accepts-exact");
let acceptExperimental = acceptExact("application/vnd.mydomain.experimental");
router.get("/api/file/:file", acceptExperimental, getFileExperimental);
router.get("/api/file/:file", getFile); // Fallback to non experimental version.
API
acceptExact(paths);
paths
Must contain a string or an array of strings.
License
1.0.0
7 years ago