Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
all good
Browse files Browse the repository at this point in the history
  • Loading branch information
willyspinner committed Feb 4, 2018
1 parent a38f20c commit 4a4a7c3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
20 changes: 16 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,23 @@ app.set('port', serverPort);
app.set('view engine', 'ejs');
app.set('views', 'views');
app.set('sockets', []);
app.set('host','169.234.99.106');
//Servloger listen:
let server = app.listen(app.get('port'),app.get('host'), function() {
console.log('Listening on host' +app.get('host')+', port ' + app.get('port'));
var server = '';
if (process.argv[2] == 'local'){

server = app.listen(app.get('port'), function() {
console.log('Listening on port ' + app.get('port'));


});
app.set('isLocal',true);
console.log('serving on local host ')
}else{
server = app.listen(app.get('port'),app.get('host'), function() {
console.log('Listening on host' +app.get('host')+', port ' + app.get('port'));
});
app.set('isLocal',false);
}


function distance(lat1, lon1, lat2, lon2) {
var p = 0.017453292519943295; // Math.PI / 180
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon"
"start": "nodemon",
"dev": "node app.js local"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions routes/loginAndRegister.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ router.post("/register", function(req, res) {
gmapsCredential: credentials.gmaps,
'authorized': true,
currentUser:req.user,
local:req.app.get('isLocal')
});
});
});
Expand Down
3 changes: 1 addition & 2 deletions routes/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ router.get('/main', function(req, res) {
gmapsCredential: credentials.gmaps,
'authorized': true,
currentUser: req.user,
'host': req.app.get('host'),
'port': req.app.get('port')
local:req.app.get('isLocal')
});
} else {
res.render('mapsFailed', {
Expand Down
8 changes: 6 additions & 2 deletions views/maps.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,12 @@
//--------------Socket Script ---------------------------//
var numUsersOnline = "h2";
//NOTE: SOCKET CONNECTION IS HARD CODED.
//var socket = io.connect("localhost:8000");
var socket = io.connect("169.234.99.106:8000");
<% if (local){%>
var socket = io.connect("localhost:8000");
<% }else{ %>
var socket = io.connect("169.234.99.106:8000");
<%}%>
socket.on('connect', function() {
});
Expand Down

0 comments on commit 4a4a7c3

Please sign in to comment.