@jondotsoy/express-async-methods

1.0.0 • Public • Published

Express Async Methods

Allow async functions on Express.IO. Only write the word Async after of your methods.

Methods allowed

  • getAsync
  • postAsync
  • headAsync
  • deleteAsync
  • putAsync
  • useAsync

How to use

import '@jondotsoy/express-async-methods'
import express from 'express'

const app = express()

app.getAsync(async (req, res) => {
  throw new Error('Fail 🍫!!!')
})

Why use it

Whitout @jondotsoy/express-async-methods

app.get(async (req, res, next) => {
  try {  
    throw new Error('Fail 🍫!!!')
  } catch (ex) {
    next(ex)
  }
})

Whit @jondotsoy/express-async-methods

app.getAsync(async (req, res) => {
  throw new Error('Fail 🍫!!!')
})

Readme

Keywords

Package Sidebar

Install

npm i @jondotsoy/express-async-methods

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • jondotsoy