1.0.2 • Published 3 years ago

catch-async-express v1.0.2

Weekly downloads
7
License
ISC
Repository
github
Last release
3 years ago

Async callback controllers

Example

When the function you write you do not know how to catch the error.

createUser = async (req: Request, res: Response) => {
    const user = await userService.createUser(req.body);
    res.status(httpStatus.CREATED).send(user);
  };

Install

  • with npm
npm install catch-async-express 
  • with yarn
yarn add catch-async-express 

Use

Help catch any error if it happens
createUser = catchAsync(async (req: Request, res: Response) => {
    const user = await this.userService.createUser(req.body);
    res.status(httpStatus.CREATED).send(user);
  });
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago