EckoThemes

Simple HTTP Server in NodeJS

Introduction

Mike Ross

Mike Ross

The most brilliant lawyer in New York City doesn't even have a degree. Currently employed as Harvey Specters associate.


LATEST POSTS

Presentation In Structured Content 22nd February, 2014

Social Profiles 01st February, 2014

NodeJS Guides

Simple HTTP Server in NodeJS

Posted on .

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 I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

This 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/');
Mike Ross

Mike Ross

http://ecko.me

The most brilliant lawyer in New York City doesn't even have a degree. Currently employed as Harvey Specters associate.

There are no comments.
View Comments (0) ...
Navigation