DrinkMasterAPI is a Java Spring Boot project that provides an API for managing drink recipes and ingredients. This project utilizes Maven for building and managing dependencies, and it uses a MySQL database to store the data.
Before running the project, make sure you have the following installed:
- Java JDK 1.8
- Maven
- MySQL Server version 5.7.42 (if using a local database)
First, make sure Maven is installed on your system. You can verify the installation by running the following command:
mvn -v
To build and run the project, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/UWDrinkMaster/drinkmaster-api.git
- Navigate to the project directory:
cd DrinkMasterAPI
- Build the project using Maven:
mvn clean install
- Run the application
Once the application is running, you can access the API documentation through Swagger UI. Open your web browser and go to:
http://localhost:8498/swagger-ui/index.html
This will display a user-friendly interface with details about the available endpoints and how to interact with the API.
If you want to use a cloud database (e.g., Amazon RDS), update the src/main/resources/application.properties
file with the following configuration:
spring.datasource.url=jdbc:mysql://drinkmaster-db.cwsgunty2bey.us-east-2.rds.amazonaws.com:3306/drink_master
spring.datasource.username=admin
spring.datasource.password=drinkmasteruw
If you prefer using a local database, follow these steps:
-
Install MySQL version 5.7.42 from the official website: MySQL 5.7 Installer.
-
After installing MySQL, open a MySQL command-line client or a MySQL GUI tool (e.g., MySQL Workbench).
-
Create a local database called "drink_master":
CREATE DATABASE drink_master;
- Run the scripts to create the required tables. Locate the SQL scripts in the
src/main/resources/sql
directory. Execute each script in the following order:
01_drop_tables.sql
01_create_tables.sql
- (Optional) Insert Initial Data
-
Make POST requests to the following endpoints in Swagger UI or any API testing tool like Postman:
user
:/user/signup
order
:/order/create
-
Execute the
02_insert_tables.sql
script to insert the initial data into the following tables:machine
ingredient
drink
To run the tests, execute the following command:
mvn test
This will run all the tests located in the src/test/java/ca/uwaterloo/drinkmasterapi
directory and show the test results in the console.
Now you're all set to use the DrinkMasterAPI project. Enjoy managing your drink recipes and ingredients through the provided API! 🍹🚀