https://github.com/pawk/express-async
Experimenting with async functions and generators used as middleware with Express.
https://github.com/pawk/express-async
Last synced: 6 months ago
JSON representation
Experimenting with async functions and generators used as middleware with Express.
- Host: GitHub
- URL: https://github.com/pawk/express-async
- Owner: pawk
- Created: 2018-05-16T07:54:02.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-16T07:54:20.000Z (almost 8 years ago)
- Last Synced: 2025-04-03T16:43:55.623Z (12 months ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Express Async
Experimenting with async functions and generators used as middleware with Express.
## Run project
```
npm i && npm start
```
### Navigate through examples
* Async-based data resolving - [/async](/async)
* Async-based error handling - [/async-error](/async-error)
* Generator-based data resolving - [/generator](/generator)
* Generator-based error handling - [/generator-error](/generator-error)
## Route callbacks
### Async-based
Example how to run Express with async routes + wrapper for async functions so you would not have to put route callback code in try/catch block.
One can actually pass it to express as-is, but could also wrap it with dedicated wrapper for easy error handling.
See [/async](/async)
### Generator-based
Implements wrapper for generator functions; it teaches generators how to yield promises. This way wrapper acting as a coroutine feeds generator with resolved result of yielded promise.
See [/generator](/generator)