Skip to content

Commit

Permalink
adding SPM monitoring and generic exception logger
Browse files Browse the repository at this point in the history
  • Loading branch information
btouellette committed Oct 3, 2016
1 parent 5148b75 commit 9961975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
"compression": "~1.0.8",
"connect-flash": "~0.1.1",
"connect-mongo": "~0.8.2",
"connect-timeout": "^1.7.0",
"cookie": "~0.1.2",
"cookie-parser": "~1.3.1",
"ejs": "~1.0.0",
"express": "~4.4.4",
"express-session": "~1.5.1",
"long-stack-traces": "^0.1.2",
"mongoose": "~4.1.6",
"moniker": "~0.1.2",
"newrelic": "^1.30.4",
Expand All @@ -24,6 +26,7 @@
"passport-twitter": "~1.0.2",
"q": "~1.0.1",
"socket.io": "~1.0.6",
"spm-agent-nodejs": "^1.30.2",
"tunnel": "0.0.3",
"twit": "~1.1.15",
"xoauth2": "^1.2.0",
Expand Down
14 changes: 11 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ if(process.env.C9_PROJECT && !process.env.MONGOLAB_URI) {
require('./config/c9');
}

// if configured to use nodetime or newrelic connect to it
// if configured to use nodetime, spm, or newrelic connect to it
if(process.env.NEW_RELIC_LICENSE_KEY) {
require('newrelic')
require('newrelic');
}
if(process.env.SPM_TOKEN) {
require ('spm-agent-nodejs');
}
if(process.env.NODETIME_ACCOUNT_KEY) {
require('nodetime').profile({
Expand Down Expand Up @@ -90,11 +93,16 @@ app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session

// error handling ==============================================================
process.on('uncaughtException', function (err) {
console.log(err);
});

// routes ======================================================================
require('./app/routes')(app, passport, mongoose); // load our routes and pass in our app and fully configured passport

// launch ======================================================================
var server = app.listen(port);
console.log('Server listening on port ' + port);

require('./app/gameserver')(server, sessionStore);
require('./app/gameserver')(server, sessionStore);

0 comments on commit 9961975

Please sign in to comment.