EckoThemes
EckoThemes

Cedar is a multi-author & personal blog theme for the Ghost platform. Featuring a minimal, responsive, content-focused design and single-column layout. Available on ThemeForest.

Harvey Specter has built a career and reputation by breaking the rules. Harvey's shoot-from-the-hip style has made him an effective lawyer and a slick character.

Share


Tags


EckoThemes

Simple HTTP Server in NodeJS

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking model that makes it lightweight and efficient.

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Node.js uses an event-driven, non-blocking model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devicesThis simple web server written in Node responds with “Hello World” for every request. To run the server, put the code into a file example.js and execute it with the node program from the command line.

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}/`);
});

Harvey Specter has built a career and reputation by breaking the rules. Harvey's shoot-from-the-hip style has made him an effective lawyer and a slick character.

View Comments