-
Url Shortner
-
Todo App
-
Blog App
-
CLI
-
Chat App
-
API Proxy
-
PostBox
-
Shareongo
-
Meet&Greet
-
Password Protected sharing
-
Init Project -> Top Level Code -> Require Modules -> Event Callback Register -> CPU Task Offload to thread pool (4-128) -> Event Loop -> Expired Timer -> IO Pooling -> Set Immediate Callback ->Close callback ->exit
The Node.js event loop is a crucial aspect that enables non-blocking I/O operations despite JavaScript being single-threaded
- Timers Phase: Executes callbacks scheduled by
setTimeout()
andsetInterval()
. - Pending Callbacks Phase: Executes I/O callbacks deferred to the next loop iteration.
- Idle, Prepare Phase: Internally used phases.
- Poll Phase: Retrieves new I/O events and executes I/O-related callbacks, blocking when necessary. It can transition to the next phase if certain conditions are met.
- Check Phase: Executes
setImmediate()
callbacks immediately after the poll phase, if scheduled. - Close Callbacks Phase: Handles close callbacks, such as 'close' events for sockets.