basic-async-handler
v1.1.1
Published
A wrapper that catches errors from async functions and sends them to your express error handlers automatically.
Readme
A wrapper that catches errors from async functions and sends them to your express error handlers automatically.
Installation:
npm install basic-async-handlerUsage:
const asyncHandler = require("basic-async-handler");
express.get(
"/some-route",
asyncHandler(async (req, res, next) => {
// some operation
// no need use try catch block
res.status(200).send({ key: "value" });
})
);