nodemon index.js not working in windows but works on macOS

17 Views Asked by At
import express from "express";
import axios from "axios";

const app = express();
const port = 3000;

app.use(express.static("public"));

app.get("/", async (req, res) => {
  try {
    const result = await axios.get("https://secrets-api.appbrewery.com/random");
    res.render("index.ejs", {
      secret: result.data.secret,
      user: result.data.username,
    });
  } catch (error){
    console.log(error);
    res.status(500);
  }
});

app.listen(port, () => {
  console.log(`Server is running on port ${port}`);
});

this code works fine on MacOS but doesn't run on windows pc i am not getting a error in TERMINAL, but in browser page doesn't load.

0

There are 0 best solutions below