Experimenting with async functions and generators used as middleware with Express.
npm i && npm start
- Async-based data resolving - /async
- Async-based error handling - /async-error
- Generator-based data resolving - /generator
- Generator-based error handling - /generator-error
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
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