New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

micro-accepts

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-accepts

A utility package which allows you to clean up before node exits

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
5
150%
Maintainers
1
Weekly downloads
 
Created
Source

micro-accepts

NPM Travis Codecov Greenkeeper badge David David Dev

micro decorator to vary request handling based on the Accept header of the request.

Installing

# npm
npm install -s micro-accepts

# yarn
yarn add micro-accepts

Usage

import accepts from 'micro-accepts'

export default accepts({
  async json(req, res) {
    // this method will handle requests that prefer json
  },
  async ['application/xml+custom'](req, res) {
    // this method will handle requests that prefer application/xml+custom
  },
  async text(req, res) {
    // this method will handle requests that accept text. This is also the default if no more specific types are accepted
  },
})

Keywords

micro

FAQs

Package last updated on 19 Nov 2019

Related posts