The Food Manager Application is a Go-based server application for managing food items and users. It provides RESTful API endpoints for adding, retrieving, updating, and deleting food items and user documents in a Firebase Firestore database.
These instructions will help you get a copy of the project up and running on your local machine for development and testing purposes.
- Go (1.16 or higher)
- Firebase Firestore account
- Firebase Admin SDK credentials (serviceAccountKey.json)
- Postman or any API testing tool
-
Clone the repository:
git clone https://github.com/yourusername/food-manager.git
-
Navigate to the project directory:
cd food-manager
-
Install project dependencies:
go mod tidy
-
Set up Firebase Admin SDK credentials:
Place your Firebase Admin SDK credentials (serviceAccountKey.json) in the project root directory.
- Configure Firebase Firestore:
Replace the Firebase Firestore configuration values in your code.
- Run the application
go run main.go
- URL: /create
- Method: POST
- Description: Create a new user's food list document.
- URL: /get?userID={userID}
- Queries:
- ?userID={userID}
- ?userID={userID}&foodID={foodID}
- Method: GET
- Description: Retrieve the food list for a specific user, or retrieve a specific food item for a user.
- URL: /add
- Method: POST
- Description: Add food items to a user's food list.
- URL: /delete
- Method: DELETE
- Description: Delete a user's food list document.
- URL: /remove?userID={userID}&foodID={foodID}&quantity={quantity}
- Method: DELETE
- Description: Remove food items from a user's food list.
Deploy the application to a production server, and ensure that your Firebase Admin SDK credentials are properly configured.
- Go - The programming language used
- Firebase Firestore - The database used
- Postman - API testing tool