micro-handlers
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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

Package Sidebar

Install

npm i micro-handlers

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

3.85 kB

Total Files

5

Last publish

Collaborators

  • acestojanoski