hmm: Serverseitiges JavaScript soll Serverseitiges Pythonscript ansprechen

Beitrag lesen

Mein server.js File sieht mit C++ aufruf so aus:

var express = require('express');
var app = express();
const addon = require('./build/Release/hello');

app.use(app.router);

app.use("/boot/css",  express.static(__dirname + '/boot/css'));
app.use("/boot/js", express.static(__dirname + '/boot/js'));
app.use("/boot/img",  express.static(__dirname + '/boot/img'));

app.get('/', function(req, res){
    res.sendfile('index.html', { root: __dirname + "/" } );
});

app.get('/app', function(req, res) {
     res.setHeader('Content-Type', 'application/json');
     res.send(JSON.stringify({ antwort:  addon.hello()}));
 });
 
app.listen(8080);

Geht das so ähnlich mit Pythonfunktionen?