diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-03 09:33:05 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-03 09:45:08 +0100 |
commit | ba5a8d89bbf049e4afc41543bcc072cccdb02669 (patch) | |
tree | 6cc6b2dca17745cc0824c7ad4515f3bc4883fa4a /server/middlewares/async.ts | |
parent | 29f148a61381727a432c22a71c7a2b7cc23d9c9e (diff) | |
download | PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.tar.gz PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.tar.zst PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.zip |
Update server dependencies
Diffstat (limited to 'server/middlewares/async.ts')
-rw-r--r-- | server/middlewares/async.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/async.ts b/server/middlewares/async.ts index 25b22596c..3a1bdabb8 100644 --- a/server/middlewares/async.ts +++ b/server/middlewares/async.ts | |||
@@ -1,12 +1,13 @@ | |||
1 | import { eachSeries } from 'async' | 1 | import { eachSeries } from 'async' |
2 | import { NextFunction, Request, RequestHandler, Response } from 'express' | 2 | import { NextFunction, Request, RequestHandler, Response } from 'express' |
3 | import { retryTransactionWrapper } from '../helpers/database-utils' | ||
4 | import { ValidationChain } from 'express-validator' | 3 | import { ValidationChain } from 'express-validator' |
4 | import { ExpressPromiseHandler } from '@server/types/express' | ||
5 | import { retryTransactionWrapper } from '../helpers/database-utils' | ||
5 | 6 | ||
6 | // Syntactic sugar to avoid try/catch in express controllers | 7 | // Syntactic sugar to avoid try/catch in express controllers |
7 | // Thanks: https://medium.com/@Abazhenov/using-async-await-in-express-with-node-8-b8af872c0016 | 8 | // Thanks: https://medium.com/@Abazhenov/using-async-await-in-express-with-node-8-b8af872c0016 |
8 | 9 | ||
9 | export type RequestPromiseHandler = ValidationChain | ((req: Request, res: Response, next: NextFunction) => Promise<any>) | 10 | export type RequestPromiseHandler = ValidationChain | ExpressPromiseHandler |
10 | 11 | ||
11 | function asyncMiddleware (fun: RequestPromiseHandler | RequestPromiseHandler[]) { | 12 | function asyncMiddleware (fun: RequestPromiseHandler | RequestPromiseHandler[]) { |
12 | return (req: Request, res: Response, next: NextFunction) => { | 13 | return (req: Request, res: Response, next: NextFunction) => { |