davidbanham / express-async-errors

async/await support for ExpressJS
Other
900 stars 43 forks source link

is this tool a replcaement of asyncWrapper ? #49

Open issam-seghir opened 9 months ago

issam-seghir commented 9 months ago

is this tool a replacement of this :

function asyncWrapper(fn) {
    return function (req, res, next) {
        fn(req, res, next).catch(next);
    };
}

  app.get('/route', asyncWrapper(async (req, res, next) => {
  const data = await someAsyncOperation();
  res.json(data);
  }));
AlanGreyjoy commented 6 months ago

yes. stop doing that.