3.1.0 • Published 1 year ago

express-asyncify v3.1.0

Weekly downloads
3,334
License
MIT
Repository
github
Last release
1 year ago

express-asyncify npm.io

Easy support async/await to express.

🚨 Since v3:

  • Node.js >= 20
  • Only ESM modules

Installation

$ npm i express express-asyncify

Usage

Asyncify express application:

import express from 'express';
import asyncify from 'express-asyncify';

const app = asyncify(express());

// ...

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

Asyncify express router:

import express from 'express';
import asyncify from '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 ci
$ npm test

License

MIT

3.1.0

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.1.3

1 year ago

2.1.2

2 years ago

2.0.3

2 years ago

2.1.1

2 years ago

2.0.2

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.0

3 years ago

1.1.0-1

3 years ago

1.1.0-0

3 years ago

1.0.1

5 years ago

1.0.0

8 years ago