A simple NodeJs service to compare with various backend technologies.
Blog post: comparing execution model of various backend technologies
A single endpoint which retrieves data from a Mongo
curl -X GET http://localhost:8080/books
Stack:
- NodeJs
- Express
- Mongoose
You can also setup a local Mongo running from a local Docker image. Pull the Mongo image and run remembering to use the -p option to the port. e.g:
docker run -p 27017:27017 --name some-mongo mongo
- event-loop execution model:
- asynchronous and non-blocking IO
- single threaded
- different styles to unblock event loop, callbacks, promises and async/await
- notes:
- dont-block-the-event-loop
- parallelism by multiple processes
- Node excels for I/O-bound work, but for expensive computation it might not be the best option.