RapydScript node app execution?

39 views
Skip to first unread message

Steve Theodore

unread,
Oct 4, 2015, 1:14:54 AM10/4/15
to RapydScript
Is there a clever workaround to for using the RapydScript -x path to run .pyj scripts which import JS libraries using 'require'? 

 I can compile something like this to JS using RapydScript and then run it in node:

def request_handler(request, response):
response.end( "<html><h1>Hello World</h1></html>" )

JS("""var http = require('http');
const PORT=8080; 
var server = http.createServer(request_handler);
server.listen(PORT, function(){
    console.log("Server listening on: http://localhost:%s", PORT);
});
""")
But I can't run it directly with RapydScript -x, which complains that _require_ is not defined, even though (at least as understand it) RapydScript is running inside of node itself.  Is there a switch or flag I'm missing? or do I just need to bite the (not so terrible) bullet of compiling and running in two lines?

 

Reply all
Reply to author
Forward
0 new messages