I ran a php script on the localhost with chrome to execute the following node.js file, named test2.js:
var express = require("express");
var app = express();
var notams = require("notams");
app.get("/", function(req, resp){
notams(['LMMM', 'LMML'], { format: 'DOMESTIC' }).then(results => {
resp.end(JSON.stringify(results));
});
});
app.listen(1000, function (){
console.log("Listening on Port 1337");
});
The php script used was the following:
<?php
echo shell_exec("node test2.js 2>&1");
?>
It worked well. The only thing that did not display is the console.log msg on the browser console. (Any reason why?)
My main problem was that when I changed the script to listen on another port, the previous port (1000) was still being used by the node, even after restarting the pc and closing the browser. How can I clear up the ports from the node? P.S.I'm running on Windows 10.