Using a code template Node.js

Asked by Илья Бабельник about a month ago


Greetings, wanted to see how this code snippet works on the playground

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

server.listen(port, hostname, () => { console.log(Server running at http://${hostname}:${port}/); });

I get the following line instead of some result:

Nothing really to see here, or 15 th3r3?

Can you tell me if I'm using the playground in the wrong way?

2 Answers


    We are not sure why you were shown this message.

    Here is the link to the playground with your code :

    You can take a look at this playground on how to make this code run on codedamn playgrounds.

    The host should always point to : and the port used should be 1337 for the browser preview to display the output.

    The following details already mentioned in the settings tab of the playground.

    I hope this resolves your issue. If you have any more queries or problems with this, please let us know





      Thank you very much!

      Your answer