Non classé

Simple HTTP Server in NodeJS

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.

var http = require('http');
http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello Worldn');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Afficher plus

Articles similaires

Un commentaire

  1. Comments which are made by the author are marked with the ‘Author’ tag, such as this one. Replies to posts are indented. Disqus comment support can be enabled via the theme options as an alternative to the default WordPress comments.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Bouton retour en haut de la page
%d blogueurs aiment cette page :

Adblock détecté

S'il vous plaît envisager de nous soutenir en désactivant votre bloqueur de publicité