This is the server-side application for the FoodHub website, which facilitates the backend operations for the food sharing platform.
- User Authentication and Authorization
- Manage Food Listings
- Search and Filter Food Listings
- User Reviews and Ratings
- Notifications for New Listings
- Node.js
- Express.js
- MongoDB
- JWT for Authentication
- Mongoose for MongoDB Object Modeling
-
Clone the repository:
git clone https://github.com/yourusername/foodhub-server.git cd foodhub-server
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following:PORT=5000 MONGODB_URI=your_mongodb_uri JWT_SECRET=your_jwt_secret
-
Start the server:
npm start
- POST /api/auth/register: Register a new user
- POST /api/auth/login: Login a user
- GET /api/foods: Get all food listings
- POST /api/foods: Create a new food listing
- GET /api/foods/:id: Get a single food listing by ID
- PUT /api/foods/:id: Update a food listing by ID
- DELETE /api/foods/:id: Delete a food listing by ID
- POST /api/reviews: Create a new review
- GET /api/reviews/food/:foodId: Get reviews for a specific food listing
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License.