Socket
Socket
Sign inDemoInstall

express-async-await

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-async-await


Version published
Maintainers
1
Created

Readme

Source

express-async-await

Use async/await in your routes without polluting / wrapping them.

Usage

Pass the app to the library and we'll monkey-patch it for you:

const aa = require('express-async-await')
const app = aa(express())

app.get('/ok', async function(req, res, next) {
  res.json({hello: 'world'})
})

app.get('/no', async function(req, res) {
  res.notSomethingICanRun({hello: 'world'})
})

app.use((err, req, res, next) => {
  console.error(err)

  res.status(500).send("Ouch!")
})

Now app.$method(route, fn) support async functions out of the box!

(have a look at the example app)

Installation

npm i express-async-await

npm add express-async-await

Keywords

FAQs

Last updated on 09 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc