index.js 691 Bytes
var express = require('express');
var router = express.Router();
const { PythonShell } = require('python-shell');
var pyshell = new PythonShell("get_game_info.py");





/* GET home page. */
router.get('/', function(req, res, next) {
  pyshell.send(JSON.stringify("리액트js"));//the problem function

  pyshell.on('message', function (row) {
    // received a message sent from the Python script (a simple "print" statement)
    console.log(row);
    res.render('index', { title: row });
  });

// end the input stream and allow the process to exit
  pyshell.end(function (err) {
    if (err){
      throw err;
    };

    console.log('finished');
  });




});

module.exports = router;