Firstly install express
const express = require("express")
const app = express()
Then add to server.js or other js files to listen port
app.listen(4000, ()=>{
console.log("server is running on port: 4000")
})
Or if you want to this way. This way is also good. It's best practices
const PORT = process.env.PORT || 4000
app.listen(PORT, ()=>{
console.log(PORT)
})
Top comments (2)
Put codes in javascript mode like this
Absolutely begging server. Not bad!