|
|
@ -3,29 +3,40 @@ var app = express(); |
|
|
var router = express.Router(); |
|
|
var router = express.Router(); |
|
|
var port = 8080; |
|
|
var port = 8080; |
|
|
|
|
|
|
|
|
router.use(function (req,res,next) { |
|
|
router.use(function (req, res, next) { |
|
|
next(); |
|
|
next(); |
|
|
console.log("%s %s => %i", req.method, req.originalUrl, res.statusCode); |
|
|
console.log("%s %s => %i", req.method, req.originalUrl, res.statusCode); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
router.get("/",function(req,res){ |
|
|
router.get("/location", function(req, res) { |
|
|
res.sendFile(__dirname + '/views/index.html'); |
|
|
var response = { "Location": "SFO" }; |
|
|
|
|
|
res.type('application/json') |
|
|
|
|
|
.send(JSON.stringify(response)) |
|
|
|
|
|
.end(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
router.get("/location",function(req,res){ |
|
|
router.get("/timeframe",function(req, res) { |
|
|
var response = { "Location": "SFO" }; |
|
|
var response = { "From": "08/05/2018", "To": "10/05/2018" }; |
|
|
res.type('application/json') |
|
|
res.type('application/json') |
|
|
.send(JSON.stringify(response)) |
|
|
.send(JSON.stringify(response)) |
|
|
.end(); |
|
|
.end(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
router.get("/participants",function(req, res) { |
|
|
|
|
|
var response = [ "Mark", "Nicolas" ]; |
|
|
|
|
|
res.type('application/json') |
|
|
|
|
|
.send(JSON.stringify(response)) |
|
|
|
|
|
.end(); |
|
|
|
|
|
}); |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
app.use("/",router); |
|
|
app.use("/",router); |
|
|
|
|
|
|
|
|
app.use("*",function(req,res){ |
|
|
app.use("*",function(req, res) { |
|
|
res.status(404).send("Not found"); |
|
|
res.status(404).send("Not found"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
app.listen(port,function(){ |
|
|
app.listen(port, function() { |
|
|
console.log("Live at Port %i", port); |
|
|
console.log("Live at Port %i", port); |
|
|
}); |
|
|
}); |
|
|
|