Created
July 9, 2014 09:42
-
-
Save Janpot/510fcd92e49675682935 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = null, | |
server = null; | |
initialise() | |
.then(function (_db) { | |
db = _db | |
return createServer(db); | |
}) | |
.then(function (_server) { | |
server = _server; | |
return server.listen(3000); | |
}) | |
.then(function () { | |
console.log('listening on 3000'); | |
}); | |
process.on('uncaughtexception', function (error) { | |
console.error(error.stack); | |
server.close() | |
.then(function () { | |
return db.close() | |
}) | |
.then(function () { | |
process.exit(1); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment