extra-express
v1.0.2
Published
Support methods for express package.
Downloads
48
Maintainers
Readme
Support methods for express package.
Need to handle error from express routes using async?
const express = require('extra-express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const sleep = (ms) => new Promise(fres => setTimeout(fres, ms));
app.get('/', express.async(async (req, res) => {
await sleep(1000);
res.send('Hello after 1s');
}));
server.listen(8000);
reference
const express = require('extra-express');
// : includes all functions of "express"
express.async(callback);
: callback(req, res, [next])