@qiwi/mware
v1.14.3
Published
Commmon middlewares collection
Downloads
35
Keywords
Readme
mware
Common middlewares collection.
Install
yarn add @qiwi/mware
npm i @qiwi/mware
Middlewares
Usage
import {cors, mdc} from '@qiwi/mware'
import express from 'express'
const app = express()
app.use(cors())
app.use(mdc())
app.listen(...)
Utils
import express from 'express'
import {util} from '@qiwi/mware'
const {asyncMiddleware} = util
...
app.get('/', asyncMiddleware(async (req, res, next) => {
...
throw new Error('Something went wrong')
}))
app.use((error, req, res, next) => {
error // Error('Something went wrong')
})
License
MIT