mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* adds types for express-async-wrap * Adds express-async-wrap properly * Adds typescript version to express-async-wrap * removes unnecessary generics * removes unnecessary comment * fix: now uses export default
18 lines
375 B
TypeScript
18 lines
375 B
TypeScript
import asyncWrap from 'express-async-wrap';
|
|
import express = require('express');
|
|
|
|
const app = express();
|
|
|
|
const promise = new Promise(resolve => {
|
|
setTimeout(() => {
|
|
resolve("Success");
|
|
}, 250);
|
|
});
|
|
|
|
const asyncHandler = async (_: express.Request, res: express.Response) => {
|
|
await promise;
|
|
res.send('promise awaited');
|
|
};
|
|
|
|
app.get('/', asyncWrap(asyncHandler));
|