This is the first time in my life I touch js or node so please bear with me.
I am trying to make my app output logs on the server side.
getUser.onclick = function () {
console.log('Server running at http://127.0.0.1:1337/');
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req.readyState === 4 && req.status === 200) {
var user = JSON.parse(req.responseText);
results.innerText += user.firstName + ' ' + user.lastName + '\n';
}
};
req.open("GET", "/user");
req.send();
Now according to this: Node js console.log is not showing anything this should work. However, this sheds more light on where the logs are actually going: console.log() does not appear in my terminal (nwjs)
When I compare the browser and console this is what I see: 
Each Get User button click corresponds to a single request. On the right side in there is a log message that I intended to be on the server side. Namely Server running at http://127.0.0.1:1337/
But I don't see it anywhere on the terminal from where I've started the app. As I understand this is an idiosyncrasy of webkit involved applications. How would I override this behavior.
The suggestion to --enable-logging=stderr in chromium-args in my package.json did not do it for me.
via user3081519
No comments:
Post a Comment