app.js
834 Bytes
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
var express = require('express');
var app = express();
app.set("view engine","ejs");
app.use(express.static(__dirname + '/public'));
app.get("/", function(req,res){
res.render("index", {low:arr[0],middle:arr[1],high:arr[2]});
});
var location;
app.get("/:location", function(req,res){
location = req.params.location;
res.render("index", {low:arr[0],middle:arr[1],high:arr[2]});
});
app.listen(8080, function(){
console.log('Server On!');
});
const {PythonShell} = require('python-shell');
var options = {
mode: 'text',
pythonOptions: ['-u'],
scriptPath: '',
encoding: 'utf8',
args: ["영통1동"]
};
var arr = new Array();
var test = new PythonShell('recommend_clothes.py', options);
var data= location;
test.send(data);
test.on('message',function(message){
arr.push(message);
console.log(arr);
})