-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (17 loc) · 743 Bytes
/
index.js
File metadata and controls
23 lines (17 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var app = require('./app');
// Only API endpoint for now
app.get('/', function(req, res){
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "GET");
res.setHeader("Access-Control-Request-Method", "*");
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
res.setHeader("Content-Type", "application/json");
app.bicimadFetcher.fetch('locations', function(body){
res.send(body);
});
});
var apiV1 = require( app.serverPath('api_v1') )(app);
var server = app.listen(app.config.port, function() {
app.modules.mongoose.connect(app.config.mongodb.url);
console.log('Listening on port %d', server.address().port);
});