forked from omart075/Ride-With-Me
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
executable file
·30 lines (25 loc) · 878 Bytes
/
server.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
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var port = process.env.PORT || 4000;
var API = require('./www/js/controllers/ApiCalls.js');
app.get('/api/uber?', function(req,res) {
API.uber(req.query.startLat, req.query.startLng,
req.query.finLat, req.query.finLng).then((data) => {
res.setHeader('Content-Type', 'application/json');
data = JSON.parse(data);
res.send(JSON.stringify(data,null,4));
});
});
app.get('/api/lyft?', function(req,res) {
API.lyft(req.query.startLat, req.query.startLng,
req.query.finLat, req.query.finLng).then((data) => {
res.setHeader('Content-Type', 'application/json');
data = JSON.parse(data);
res.send(JSON.stringify(data,null,4));
});
});
// Start App
app.listen(port, function() {
console.log('Listening on port ' + port);
});