Skip to content

acestojanoski/micro-handlers

Repository files navigation

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

About

Different handlers based on HTTP method for Micro

Resources

License

Stars

Watchers

Forks

Packages

No packages published