Please how many time do I have to set the localhost with node.js

I finally set up the locahost server with node.js. but am a bit confuse and I have a question, plz will i have to be setting up the server for every project am working on or just once?

1 Like

@cassyjay Is this what you’ve done so far:

If so, then yes. You’ll start a new server for each of your apps. If not, can you share more details?

1 Like

yes I did this:

const http = require('http');

const hostname = '';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
so, that mean each project am working on, I've to create a new localhost then?

@cassyjay Yes, I believe so. Which fCC projects are you referring to?

It’s just a personal project, not fcc projects though. thanks a lot for your time.

1 Like