Follow these professional steps to set up your Node + Express backend correctly.
This folder will contain all your backend files, keeping it separate from the frontend.
mkdir backend
cd backend
This creates package.json which stores dependencies & project config.
npm init -y
index.js will be your backend server’s entry point.
touch index.js
Add Express to handle APIs, routing, and server logic.
npm install express
Paste this into index.js and run it.
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send("Backend server is running successfully!");
});
const PORT = 5000;
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});