Ask coding questions

← Back to all posts
How do i work with nodeJS in repl.it?
akkshayTandon (1)

i have just started to learn nodeJS. But i am unable to understand how to create server in repl.it? someone please guide me.

Comments
hotnewtop
ch1ck3n (2380)
const express = require('express');

const app = express();

app.get('/', (req, res) => {
  res.send('Hello Express app!')
});

app.listen(3000, () => {
  console.log('server started');
});

this is an example server using express

akkshayTandon (1)

@ch1ck3n thanks for reply.i didn't expected it so soon.
I was using port 80 which is localhost.
Do i need to install npm and nodemon packages?

ch1ck3n (2380)

@akkshayTandon If you're gonna host on replit you have to use 3000 as the port

and no, it should automatically install it for you.

ch1ck3n (2380)

@akkshayTandon can you press the checkmark next to my name if it helped

Coder100 (18915)

The host has to be 0.0.0.0, not 127.0.0.1. Also, to use nodemon, some configuration is required.