0.1.1 • Published 2 years ago

micro-handlers v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

micro-handlers

Different handlers based on HTTP method for Micro

CI Downloads Install size

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

License

MIT

Related