test.js
838 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
39
40
41
42
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동"]
};
const appdata = require('./js/app.js');
var arr;
var test = new PythonShell('recommend_clothes.py', options);
var data= appdata.locationData();
test.send(data);
test.on('message',function(message){
arr = message.split('\n');
console.log(arr);
})