httpserver.js 515 Bytes
var http = require('http');
var nsr = require('node-simple-router');
var router = nsr();

var config;
var httpServer;

function start(_config) {
    if (_config != undefined) {
        config = _config;
    }
    listenPort = config.globals.admin_port;

    httpServer = http.createServer(router).listen(listenPort);
    console.log('HTTP server listens on port ' + listenPort);

    return httpServer;
}

function setConfig(_config) {
    config = _config;
}

exports.start = start;
exports.setConfig = setConfig;