-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathserver.js
More file actions
33 lines (26 loc) · 759 Bytes
/
server.js
File metadata and controls
33 lines (26 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var express = require('express'),
fs = require('fs');
var app = express();
app.use(express.bodyParser());
app.use(app.router);
app.conString = "postgres://bdollins:ZAQ!xsw2@localhost:5432/geo2";
//app.use(error);
process.on('uncaughtException', function (error) {
console.log(error.stack);
});
// dynamically include routes (Controller)
fs.readdirSync('./controllers').forEach(function (file) {
if(file.substr(-3) == '.js') {
route = require('./controllers/' + file);
route.controller(app);
}
});
/*function error(err, req, res, next) {
// log it
console.log(err);
//console.error(err.stack);
// respond with 500 "Internal Server Error".
res.send(500);
}*/
app.listen(3000);
console.log('Listening on port 3000...');