I'm having trouble getting a nodejs app up and running. At present, with the webservice running, https://tools.wmflabs.org/translation-server reads "502 Bad Gateway".
I've checked out the script from https://github.com/zotero/translation-server, and have been able to get it running locally using npm start (though sometimes it complains that its default port, 1969, is not available).
I've modified the script to run as a webservice by replacing
var port = config.get('port'); with var port = parseInt(process.env.PORT, 10);, per https://wikitech.wikimedia.org/wiki/Help:Toolforge/Web
When I run npm start now, I receive the error Port should be > 0 and < 65536. Received NaN.; presumably process.env.PORT is not defined in a shell context.
The other thing I've noticed is that server.js sits in www/js/src rather than www/js. I've tried copying the file to www/js but still get the 502 Bad Gateway message, which makes it tricky to debug what's going on. But this said, the package.json does point to src/server.js as the default script.
If anyone has any thoughts as to what I might try or how I might debug them, I'd be very glad to hear them!