JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7096
  • Score
    100M100P100Q126375F
  • License MIT

Easy support async/await to express

Package Exports

  • express-asyncify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-asyncify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

express-asyncify Build Status

Easy support async/await to express.

Installation

$ npm install express-asyncify --save

Usage

Asyncify express application:

const express = require('express');
const asyncify = require('express-asyncify');

const app = asyncify(express());

// ...

app.get('/', async (req, res) => {
    const posts = await Post.findAll();
    res.render('index', {posts});
});

Asyncify express router:

const express = require('express');
const asyncify = require('express-asyncify');

const app = express();
const router = asyncify(express.Router());

// ...

router.get('/', async (req, res) => {
    const posts = await Post.findAll();
    res.render('index', {posts});
});

app.use('/blog', router);

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

License

MIT