request-type

0.0.1 • Public • Published

request-type

NPM version Build Status Coverage Status

Node.js Content-Type checking middleware.

Install

NPM

$ npm install request-type

Node.js

var express    = require('express');
var requestType = require('request-type');
 
var app = express();
 
app.post('/', requestType('application/*'), function(req, res, next) {
    res.send('Success!');
});
 
app.put('/', requestType(['application/json', 'application/xml']), function(req, res, next) {
    res.send('Wunderbar!');
});
 

License

MIT

Package Sidebar

Install

npm i request-type

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • davidtpate