Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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);