express-accepts-exact

1.0.0 • Public • Published

express-accepts-exact

Simple express middleware for filtering routes by exact matches of Accepts header.

NPM Version NPM Downloads

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

ISC

Readme

Keywords

Package Sidebar

Install

npm i express-accepts-exact

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • wormss