1.0.0 • Published 5 years ago

media-type-express v1.0.0

Weekly downloads
3
License
LGPL-3.0
Repository
github
Last release
5 years ago

Media type middleware

A simple Express middleware to check incoming media type.

Usage

const express = require('express');
const MediaType = require('media-type-express');

const mediaType = MediaType({
    allowedMediaTypes: [ 'application/json' ]
});

const router = express.Router();

router.use(mediaType);

Notes

If the media type is not allowed a Http error 415 (Unsupported media type) will be answered.