Setup Server.js for Node Js Application
In this post we will setup server.js file for our node js application.
First go to backend/src/server.js file and write below code. ->
import dotenv from "dotenv"
import app from "./app.js" //because in package.json me type:module hai
dotenv.config()
const PORT = process.env.PORT || 5000
app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`)
})
and save
Comments
Post a Comment