const express = require('express'); const app = express(); const warp = require('express-auto-async-handler'); async function a() {}; app.get('/path1', a); app.all('/path4', a); app.use(a); router1.get('/path5', a); warp(app); app.listen(PORT) // or just warp(ap...
$ npm install auto-async-wrap --save usage import{Router}from'express'importautoAsyncWrapfrom'auto-async-wrap'constrouter=Router()router.use(['every middlewares what you use.'])router.use(errorHandler)// after all middlewares are registed.autoAsyncWrap(router) ...