0.1.0 • Published 1 year ago

@altipla/express-async-handler v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

express-async-handler

Transform async handlers to use them in Express v4.

Install

npm install @altipla/express-async-handler

Usage

import express from 'express'
import type { Request, Response } from 'express'
import { asyncHandler } from '@altipla/express-async-handler'

async function exampleHandler(req: Request, res: Response) {
  await (...)
  return 'ok'
}

let app = express()
app.use('/example', asyncHandler(exampleHandler))