-
Notifications
You must be signed in to change notification settings - Fork 7
/
server.js
41 lines (32 loc) · 1.22 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
const express = require('express');
const path = require('path');
const app = express();
const public = path.join(__dirname, '/public');
app.use('/', express.static(public));
const game_config = require('./config/game-map_v0.1.json');
console.log("MapCols:", game_config.cols + ' | MapRows:' + game_config.rows)
const survey_config = require('./config/survey_v0.2.json');
const navigation_config = require('./config/navigation-map_v0.1.json');
app.get('/', function(req, res) {
res.sendFile(path.join(public , 'index.html'));
});
app.get('/socket_url', function(req, res){
console.log('socket-url route called');
res.json({ "socketURL": process.env.LOCAL_SOCKET_URL });
});
app.get('/game_config', function(req, res){
console.log('game_config route called');
res.json(game_config);
});
app.get('/survey_config', function(req, res){
console.log('survey_config route called');
res.json(survey_config);
});
app.get('/navigation_config', function(req, res){
console.log('navigation_config route called');
res.json(navigation_config);
});
console.log("Server Address: "+ process.env.IP+ "/"+process.env.PORT)
app.listen(process.env.PORT, process.env.IP, function() {
console.log("Server has started" )
});