Lecture 3 Node - JS - Modules
Lecture 3 Node - JS - Modules
JS
Lecture 3
Introduction & its modules
Road Map
How Mean Stack works?
Introduction to Node.JS
◦ Concurrency
◦ Event Loop/Event Emitter
◦ Non Blocking I/O
◦ Performance
Node.JS Modules
NPM
Installation
Getting Started
JSON
JSON
JSON JSON
3
What is NodeJS?
A JavaScript runtime environment running
Google Chrome’s V8 engine
◦ a.k.a. a server-side solution of JS
◦ Compiles JS, making it really fast
Runs over the command line
Designed for high concurrency
of unhandled tasks.
◦ These queues include things such as events,
timers, intervals, and immediates.
◦ Each execution of the event loop, known as a
cycle, causes one or more tasks to be dequeued
and executed.
Event Handling
Event Loop Example
Request for “index.html” comes in
Stack unwinds and ev_loop goes to sleep
File loads from disk and is sent to the client
Event Loop
Event Loop
As these tasks execute, they can add more
tasks to the internal queues.
They use async function calls to maintain