express-accepts-exact
v1.0.0
Published
Do an exact match on a single or list of accepts.
Readme
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 --saveExample
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.
