NodeJs Flashcards
is a runtime environment that allows you to execute JavaScript code on the server side.
Node.js
Non-blocking I/O operations make it efficient for handling multiple request simultaneously
Asynchronous and Event-Driven
Uses single-threaded event loop but can handle many connections concurrently through callbacks, promises, or async/await.
Single-Threaded but Scalable
NPM (Node Package Manager) provides a vast library of packages and modules
Rich Ecosystem
Runs a various operating systems like Windows, Linux, and macOS
Cross-Platform
Built on the V8 engine, which compiles JavaScript to machine code.
Fast Performance
var http = require(‘whathere’);
var http = require(‘http’);
http.createServer(whathere (req, res)){
http.createServer(function(req,res)){
res.writeHead(200, {‘whathere’: ‘text/html’});
res.writeHead(200){‘Content-Type’: ‘text/html’});
res.end(‘hello world!’);
}).listen(whathere);
res.end(‘hello world!’);
}).isten(8080);
var http = require(‘http’);
http.createServer(function (req, res){
res.writeHead(200, {‘Content-Type’: ‘text/html’});
res.end(‘Hello World’);
}
).listen(8080);