Page Is Not Refreshing, Until I Close Everything

Good morning.

I’m practicing making an Express application. Here is the code:

const express = require("express");

const app = express();

app.get("/", (req, res) => {
  console.log("user hit the resource");
  res.send("Home Page NM");

app.listen(5000, () => {
  console.log(`PORT IS 5000`);

When I open up my local host, everything will be fine. However, when I change the res.send() to send a different type of text, it will not update even though I refresh the page and “user hit the resource” is displayed on the console again. What can I do?

Thank you.

You have to restart the server. You can install the nodemon package to have it auto restart on save.

I have it installed, but how do I run it?

Did you read the docs?

You just call it instead of node nodemon server.js

You can add it as a dev script as well.

"scripts": {
  "start": "node server.js",
  "dev": "nodemon server.js"

Thank you, however when I run npm start dev, I still need to manually close the local host tab AND kill the terminal to make it refresh and show new information.

Screenshot 2022-07-21 182624

Screenshot 2022-07-21 182708

Local Host:
Screenshot 2022-07-21 182739

Nevermind, I have found my solution.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.