Changeset 36333 for other-projects


Ignore:
Timestamp:
2022-07-29T00:26:00+12:00 (21 months ago)
Author:
davidb
Message:

Sending back the JSON from a get-doi python script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/bib-stinky/trunk/nodejs-server/express-web-server.js

    r36329 r36333  
    2222
    2323app.get("/", (req, res) => {
    24     //res.send('Hello World!')
    25     //res.json({ message: "Test JSON message" });
    2624    res.redirect("/index.html");
    2725});
    2826
    2927
    30 app.get("/python-test", (req, res) => {
     28app.get("/api/get-doi", (req, res) => {
     29    var doi = req.query.doi;
    3130
    3231    var dataToSend;
    3332
    3433    // Spawn new child process to call the python script
    35     const python = spawn('python3', ['script1.py']);
     34    const python = spawn('python3', ['doi-stinky/oacore-get-doi.py', doi, "oacore-output.json"]);
    3635   
    3736    // Collect data from script
     
    4443    python.on('close', (code) => {
    4544    console.log(`child process close all stdio with code ${code}`);
    46 
    47     res.send(dataToSend)   
     45   
     46    //res.send(dataToSend)
     47    res.sendFile("oacore-output.json", { root: __dirname });   
    4848    });   
    4949});
Note: See TracChangeset for help on using the changeset viewer.