test.js 784 Bytes
var http = require('http');
var fs = require('fs');
var app = http.createServer(function(request,response){
    var url = request.url;
    if(request.url == '/'){
      url = '/index.html';
    }
    if(request.url == '/favicon.ico'){
      response.writeHead(404);
      response.end();
      return;
    }
    response.writeHead(200);
    response.end(fs.readFileSync(__dirname + url));
 
});
app.listen(8080);

const {PythonShell} = require('python-shell');

var options = {
  mode: 'text',
  pythonOptions: ['-u'],
  scriptPath: '',
  encoding: 'utf8',
  args: ["영통1동"]
};

var arr;
var test = new PythonShell('recommend_clothes.py', options);
var data='영통1동';
test.send(data);
test.on('message',function(message){
  arr = message.split('\n');
  console.log(arr);
})