Problem
Developers currently have to manually restart the backend Node.js server every time a code change is made during development, which slows down the workflow.
Current Behavior
When making changes to backend files (like server.js, controllers, or routers), the server keeps running the old code. We have to manually stop the server (Ctrl+C) and run node server.js again to see the updates.
Expected Behavior
The backend server should automatically detect file saves and restart itself seamlessly, allowing immediate testing of new changes.
Steps to Reproduce
- Start the backend server using
node server.js
- Make a visible change in any backend file (e.g., modifying an API response in
server.js)
- Save the file
- Test the API and see that the old response is still returned because the server didn't restart.
Screenshots
Not applicable.
Environment
- Environment: Local Development (Node.js)
- OS: Windows / macOS / Linux
Additional Context
We should install nodemon as a development dependency to solve this.
Proposed solution:
- Run
npm install --save-dev nodemon
- Add a dev script to
package.json:
"scripts": { "dev": "nodemon server.js", "start": "node server.js" }
- Developers can then just run
npm run dev to start the server with hot-reloading.
Problem
Developers currently have to manually restart the backend Node.js server every time a code change is made during development, which slows down the workflow.
Current Behavior
When making changes to backend files (like
server.js, controllers, or routers), the server keeps running the old code. We have to manually stop the server (Ctrl+C) and runnode server.jsagain to see the updates.Expected Behavior
The backend server should automatically detect file saves and restart itself seamlessly, allowing immediate testing of new changes.
Steps to Reproduce
node server.jsserver.js)Screenshots
Not applicable.
Environment
Additional Context
We should install
nodemonas a development dependency to solve this.Proposed solution:
npm install --save-dev nodemonpackage.json:"scripts": { "dev": "nodemon server.js", "start": "node server.js" }npm run devto start the server with hot-reloading.