- commit
- 6d59053bf962e6efe8cb7cbed72934ca690ed254
- parent
- dff2039ba6c2232657660c4a58ebf4096fed77a0
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2017-11-18 08:27
close db connection on exit
Diffstat
| M | app.js | 4 | ++++ |
1 files changed, 4 insertions, 0 deletions
diff --git a/app.js b/app.js
@@ -7,6 +7,7 @@ 7 7 */ 8 8 9 9 var url = require('url'); -1 10 var process = require('process'); 10 11 11 12 var express = require('express'); 12 13 var http = require('http'); @@ -29,6 +30,9 @@ server.listen(PORT, HOST, function() { 29 30 }); 30 31 31 32 var db = anyDB.createPool(DATABASE_URL); -1 33 process.on('exit', (code) => { -1 34 db.close(); -1 35 }); 32 36 33 37 var throwErr = function(err) { 34 38 if (err) throw err;