Skip to content

Commit 0fc5899

Browse files
committed
frontend error fixed
1 parent 6900e24 commit 0fc5899

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

backend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "1.0.0",
44
"main": "index.js",
55
"scripts": {
6-
"test": "echo \"Error: no test specified\" && exit 1"
6+
"test": "echo \"Error: no test specified\" && exit 1",
7+
"server":"nodemon server.js"
78
},
89
"keywords": [],
910
"author": "",

backend/server.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const express = require('express');
22
const mongoose = require('mongoose');
33
const cors = require('cors');
4-
const foodRoutes = require('./routes/foodRoutes'); // this should be your router, not model
4+
const foodRoutes = require('@/routes/foodRoutes');
55

66
const app = express();
77
const PORT = 5000;
@@ -10,10 +10,10 @@ app.use(cors());
1010
app.use(express.json());
1111

1212
mongoose.connect('mongodb://127.0.0.1:27017/food_rescue')
13-
.catch(err => console.error(' MongoDB connection error:', err));
13+
.catch(err => console.error(' MongoDB connection error:', err));
1414

15-
mongoose.connection.on('connected', () => console.log(' MongoDB connected'));
16-
mongoose.connection.on('error', err => console.error(' MongoDB connection error:', err));
15+
mongoose.connection.on('connected', () => console.log(' MongoDB connected'));
16+
mongoose.connection.on('error', err => console.error(' MongoDB connection error:', err));
1717

1818
app.get('/', (req, res) => res.send('Food Rescue API is running.'));
1919

@@ -32,5 +32,5 @@ app.use((err, req, res, next) => {
3232
});
3333

3434
app.listen(PORT, () => {
35-
console.log(`🚀 Server running on http://localhost:${PORT}`);
35+
console.log(` Server running on http://localhost:${PORT}`);
3636
});

0 commit comments

Comments
 (0)