Http server.

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

new HTTPServer(ip, port[, options])

Constructor for HTTPServer object.

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.

request (HTTPRequest)

Client request

response (HTTPServerResponse)

Response object

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