r/FullStack • • Jul 26 '25

Personal Project Trying to run cloned project from GitHub

Whenever I try to run any project from GitHub, I always get an error. What can I do? I just want to see how project runs and looks. The problem is configurations or version differences idk.

2 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/CompanyBrilliant7261 Jul 30 '25 edited Jul 30 '25

Got it, thanks. I have already run the "node index.js" command in the terminal. It did not work. The index.js file is like this:

global.foodData = require("./db")(function call(err, data, CatData) {
  if (err) console.log(err);
  global.foodData = data;
  global.foodCategory = CatData;
});

const express = require("express");
const cors = require("cors"); // Add this line
const app = express();
const port = 5000;

app.use(cors({ origin: "http://localhost:3000" })); // Use cors middleware

app.use(express.json());

app.get("/", (req, res) => {
  res.send("Hello World!");
});

app.use("/api/auth", require("./Routes/Auth"));

app.listen(port, () => {
  console.log(`Example app listening on http://localhost:${port}`);
});