HTTPServer

Http server.

var http = new HTTPServer("127.0.0.1", 8080);
http.onrequest = function(request, response) {
    console.log(request.method + " " + request.url);
    console.log(JSON.stringify(request.headers));
    response.write("Hello! ");
    response.end("This is Nidium");
};

new HTTPServer(ip, port[, options])

Constructor for HTTPServer object.

Arguments:
ip (String)

The ip address to bind to

port (Integer)

The port to listen to

options (Object)

HTTPServer options

reusePort (Boolean)

Allows multiple HTTPServer to bind to the same port,

Event: onDisconnect()

Event that fires on disconnect.

Event: ondata()

Event that fires on data.

Event: onrequest(request, response)

Event that fires when the server has read the complete http request.

Parameters:
request (HTTPRequest)

Client request

response (HTTPServerResponse)

Response object


Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!