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.

You are viewing a single comment. View All
ch1ck3n (2389)
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 (2389)

@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 (2389)

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