- Updated backend userService to calculate total litter collected across all attended events - Added totalLitterCollected field to UserProfile interface - Added new statistics card showing total litter collected in kg - Updated profile grid layout to accommodate 5 statistics cards - Displays litter collected with 1 decimal place precision
55 lines
1.1 KiB
Markdown
55 lines
1.1 KiB
Markdown
# Starting the Application
|
|
|
|
## Backend Server
|
|
|
|
Open a terminal and run:
|
|
|
|
```bash
|
|
cd server
|
|
npm run dev
|
|
```
|
|
|
|
The backend server should start on `http://localhost:3005`
|
|
|
|
You should see output like:
|
|
```
|
|
Server running on port 3005
|
|
Connected to database
|
|
```
|
|
|
|
## Frontend Development Server
|
|
|
|
Open another terminal and run:
|
|
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
The frontend should start on `http://localhost:5173`
|
|
|
|
## Troubleshooting
|
|
|
|
### Backend won't start
|
|
- Check if port 3005 is already in use: `lsof -ti:3005`
|
|
- Check database connection in `server/.env`
|
|
- Run `cd server && npm install` to ensure dependencies are installed
|
|
|
|
### Frontend won't start
|
|
- Check if port 5173 is already in use
|
|
- Run `npm install` to ensure dependencies are installed
|
|
- Check `.env.local` for correct API URL
|
|
|
|
### "Server returned non-JSON response" error
|
|
- This means the backend server is not running
|
|
- Start the backend server first (see above)
|
|
- Check that `VITE_API_BASE_URL` in `.env.local` matches your backend URL
|
|
|
|
## Quick Check
|
|
|
|
Test if backend is running:
|
|
```bash
|
|
curl http://localhost:3005/api/events
|
|
```
|
|
|
|
Should return JSON with events list.
|