Skip to content
This repository has been archived by the owner on Dec 8, 2019. It is now read-only.

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
devfacet committed May 29, 2017
1 parent 2828bd2 commit 12a4a35
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/server.js
Expand Up @@ -13,6 +13,7 @@ var path = require('path');
var http = require('http');
var WebSocket = require('ws');

// Init the vars
var ARGS = utilex.args();
var APP_PATH = path.resolve(path.join(__dirname, '..'));
var NODE_PORT = process.env.NODE_PORT || ARGS['port'] || '3000';
Expand All @@ -23,7 +24,7 @@ process.on('uncaughtException', function (err) {
console.error(err);
});

// Init server
// Init the server
var app = express();
var server = http.createServer(app);
var ws = new WebSocket.Server({server});
Expand All @@ -32,11 +33,11 @@ app.set('NODE_PORT', NODE_PORT); // server port
app.set('NATS_MON_URL', NATS_MON_URL); // nats monitoring url
app.set('WS', ws); // websocket server

app.use(require('./metrics')(app)); // metrics
app.use(require('./routes')(app)); // routes
app.use(require('./metrics')(app)); // metrics
app.use(require('./routes')(app)); // routes
app.use(express.static(path.join(APP_PATH, 'public'))); // static file serving

// Start web server
server.listen(NODE_PORT, function listening() {
// Start the server
server.listen(NODE_PORT, function() {
console.log('Listening on %d', server.address().port);
});

0 comments on commit 12a4a35

Please sign in to comment.