Skip to content

Commit

Permalink
Merge branch 'master' of github.com:kartikk221/hyper-express
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikk221 committed Dec 20, 2022
2 parents 015893e + b74793e commit dd35dbf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/Middlewares.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ router.use('/api', (request, response, next) => {
server.use(async (request, response) => {
// You can also just return new Promise((resolve, reject) => {}); instead of async callback
try {
await some_async_operation(request, response);
await some_async_operation();
// The request proceeds to the next middleware/handler after the promise resolves
} catch (error) {
return error; // This will trigger global error handler as we are returning an Error
}
});
```
```

0 comments on commit dd35dbf

Please sign in to comment.