-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (34 loc) · 954 Bytes
/
app.js
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
34
35
36
37
38
39
40
var
restify = require('restify')
, bunyan = require('bunyan')
, PrettyStream = require('bunyan-prettystream')
, pg = require('pg')
;
var prettyStdOut = new PrettyStream();
prettyStdOut.pipe(process.stdout);
var server = restify.createServer({
log: bunyan.createLogger({
name: "profile_search"
, streams: [{
level: 'debug'
, type: 'raw'
, stream: prettyStdOut
}]
})
});
/* Event handlers */
server.on('uncaughtException', function (req, res, route, error) {
server.log.error(error);
res.send(500);
});
var port = Number(process.env.PORT || 8081);
server.listen(port, function() {
server.log.info('%s listening at %s', server.name, server.url);
});
/*
* Export the restify app for other modules to use...
*/
module.exports.server = server;
require('./db');
require('./profiles');
require('./routes');