Jump to content

bethe

Members
  • Posts

    3
  • Joined

  • Last visited

bethe's Achievements

Newbie

Newbie (1/14)

  • One Month Later Rare
  • Week One Done Rare
  • Dedicated Rare
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Using port 3000: Using port 3001: So I guess Passenger just don't work with such toy scripts. Maybe if some http server capabilities is checked during startup, my script #1 "exited prematurely." Thanks
  2. Error ID: 9867a925 Details: Web application could not be started by the Phusion Passenger(R) application server. Please read the Passenger log file (search for the Error ID) to find the details of the error. I look into the logs and find "App 8492 output: Error: listen EADDRINUSE: address already in use 127.0.0.1:3000" But both scripts listen on that address and port, #2 runs without errors.
  3. Following two app.js both run fine on my local computer. But when I upload them to Tommy, the first script went wrong while the second is OK. So I wonder what could cause this? They seem to do the same thing. (1) app.js using net var net = require("net"); var server = net.createServer(function (socket) { socket.on("data", function (data) { let resp = "HTTP/1.0 200 OK\r\n" + "Content-Type: text/html\r\n" + "Content-Length: 10\r\n" + "\r\nIt works!!"; socket.write(resp); }); }); server.listen(3000, '127.0.0.1', function () { console.log("listening on port 3000"); }); (2) app.js using http const http = require('http'); const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/html'); res.end(`Node.js works!`); }); server.listen(3000, '127.0.0.1', () => { console.log("listening on port 3000"); });
×
×
  • Create New...