-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (24 loc) · 814 Bytes
/
index.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
/*jslint node: true, varstmt: false */
'use strict';
var http = require('http'),
nodeSimpleRouter = require('node-simple-router'),
router = nodeSimpleRouter(),
server = http.createServer(router),
foursquareHandler = require('./foursquare-handler'),
ipinfoHandler = require('./ipinfo-handler');
if (!process.env.API_PROXY_PORT) {
throw new Error('API_PROXY_PORT must be set');
}
process.on('SIGTERM', function () {
process.exit(0);
});
process.on('SIGINT', function () {
process.exit(0);
});
router.get('/foursquare-venues', foursquareHandler);
router.get(/^\/ipinfo/, ipinfoHandler);
server.listen(process.env.API_PROXY_PORT, 'localhost', function () {
console.log('Server start. Listening on ' + server.address().address + ':' +
server.address().port
);
});