micro-handlers
v0.1.1
Published
Different handlers based on HTTP method for Micro
Downloads
11
Maintainers
Readme
micro-handlers
Different handlers based on HTTP method for Micro
Install
npm install micro-handlers
or
yarn add micro-handlers
Usage
const microHandlers = require('micro-handlers')
module.exports = microHandlers({
GET: (req, res) => {
res.end('Hello from GET')
},
POST: (req, res) => {
res.end('Hello from POST')
},
})
API
microHandlers(handlers)
handlers
Type: Record<Method, Handler>
Method
Type: GET | POST | PUT | PATCH | DELETE
Handler
Type: Function