logo

Introduction to Node.js

Node.js is an asynchronous event-driven JavaScript runtime built on Chrome’s V8 JavaScript engine. It is designed to build scalable network applications and backend servers.

Why Learn This?

Javascript on the Server

Node.js liberates JavaScript from the browser, allowing you to interact with file systems, deploy HTTP servers, and query databases.

Non-Blocking I/O

Node uses an event-loop to handle thousands of concurrent requests incredibly quickly without waiting for data functions to finish.

The NPM Universe

Node comes with NPM, giving you immediate access to the largest registry of pre-written software packages in the world.

Installing Node.js

To use Node, you must download the runtime engine onto your computer, enabling the "node" command locally.

Running a backend server script:
server.js
1// server.js 2const http = require('http'); 3 4const server = http.createServer((req, res) => { 5 res.statusCode = 200; 6 res.end('Hello World Backend 7'); 8}); 9 10server.listen(3000, () => { 11 console.log('Server running on port 3000'); 12}); 13 14// Run it using your terminal: 15// node server.js

Official Learning Resources