Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
- Installing and Setting up Node.js
- Nodejs.org Code
- Handling http Requests
- NPM / Modules
- Serving HTML Files
- Installing and Setting Up Node.js
- NPM and Basic HTTP Server
- Serving HTML Files
Install NodeJS from the official node.js Site: nodejs.org
Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. To dig deeper, visit npmjs.com
Node JS Web Server helps in handling HTTP Requests and Serving HTML Files to the Browser.
``` const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});```
To dig deeper in NodeJS Web Server,visit this link: Getting_Started_Guide
coming soon...
MIT © Nishi Gaba