Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build a Simple Dynamic Site with Node.js Creating a Simple Server in Node.js Creating a Simple Server

James Zwar
James Zwar
11,737 Points

Killing the process?

Loving the lesson - just a quick question:

I tried running this, but node was still running the workspaces terminal. I think maybe this is because when the terminal is hidden in workspaces it kills the bash instance running at that point, and then when show terminal is selected - a new bash instance is created. Is this correct?

Also, would it be possible to run multiple instances of node but just on different ports?

Thanks!

1 Answer

I believe you may be right about the issue you're running into when closing the terminal.

To answer the second part of your question you certainly could run multiple server instances if you wished to:

http.createServer(function (request, response) {
  response.writeHead(200, {'Content-Type': 'text.plain'});
  response.end("Hello World\n");
}).listen(3000);

http.createServer(function (request, response) {
  response.writeHead(200, {'Content-Type': 'text.plain'});
  response.end("Goodbye Cruel World\n");
}).listen(8080);