-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
35 lines (31 loc) · 1.06 KB
/
app.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
var express = require('express');
var app = express();
var path = require('path');
var cmd = require('node-cmd');
app.use(express.static('public'));
app.get("/",(req,res,next) => { res.sendFile(path.join(__dirname + '/index.html'))});
app.post("/video/:vidId",(req,res,next) => {
console.log("RECV POST "+req.params.vidId);
cmd.get('cd ./algo_plus_chat && python3.7 main.py '+req.params.vidId,
function(err,data,stderr){
console.log(err);
var l = [];
data.split("\n").forEach(element => {
var l2 = [];
element.split(",").forEach(elem2=>{
elem2 = elem2.replace('(','');
elem2 = elem2.replace(')','');
elem2 = elem2.replace(' ','');
l2.push(elem2);
})
if (l2.length >= 2){
console.log(l2);
l.push(l2);
}
});
console.log("SENDING RES");
res.json(l);
}
)})
app.listen(80, () => {
});