-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAWS.js
More file actions
58 lines (33 loc) · 1.23 KB
/
AWS.js
File metadata and controls
58 lines (33 loc) · 1.23 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//NODEJS RUNNING ON AWS SERVER MACHINE
var express = require('express');
var http = require('http');
var app = express();
fs = require('fs');
var exec = require('child_process').exec;
app.get('/:lat/:long', function (req, response) {
var lat = (req.params.lat);
var long = (req.params.long);
console.log(req.url);
response.contentType('text/html');
exec("curl http://127.0.0.1:4242/relative-to-fence/554b5ef24eda842453000001/"+lat+'/'+long, function (error, stdout, stderr) {
// output is in stdout
console.log(stdout);console.log(error);console.log(stderr);
response.send(stdout);
});
});
app.get('/checkfences', function (req, response) {
// var uuid = (req.params.uuid);
console.log(req.url);
response.contentType('text/html');
exec("curl http://127.0.0.1:4242/fences", function (error, stdout, stderr) {
// output is in stdout
console.log(stdout);console.log(error);console.log(stderr);
response.send(stdout);
console.log(stdout);
});
});
var server = app.listen(process.env.PORT||3000, function () {
var host = server.address().address;
port = server.address().port;
console.log('server listening at http://%s:%s', host, port);
});