app.js 834 Bytes
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);
})