The web application allows users to manage your favorite recipes.
Recipe API Specification Document: Download
Recipe API Technical Document: Download- JDK 8
- Maven
- Eclipse or IntelliJ Idea
- Lombok plugin for IDE
- Docker Desktop (optional, you can run on your PC)
- PostgreSQL (optional, you can use H2 DB)
API config file includes two DB configurations: PostgreSQL and H2 in-memory DB. The project uses H2 DB as default. If you have PostgreSQL on your PC, you can change the configuration. You don’t need to do anything if you want to run with H2 DB. The configuration file name is application.yml under the resources directory.
- H2 DB URL: http://localhost:8080/api/recipeManagement/v1/h2-console
- JDBC URL: jdbc:h2:mem:testdb
- User Name: admin
- Password: admin
Build Recipe API using maven.
mvn clean install
Run spring boot application.
mvn spring-boot:run
API includes docker config files which are docker file and docker-compose file. Docker creates two containers. The first one is for spring application, and the second is for PostgreSQL DB. Docker uses the application-docker.yml file under the resources directory for application config.
Build Recipe API using maven.
mvn clean install
Create containerized images for the application using a docker-compose command.
docker-compose build
Run all containers using the single command as below.
docker-compose up
In addition, to stop all containers, you can use the following command.
docker-compose down
Recipe API includes Swagger UI implementation. You can get information about API endpoints and models on Swagger UI. You can invoke the API endpoints with Swagger UI.
- Swagger UI: http://localhost:8080/api/recipeManagement/v1/swagger-ui/
- Username: admin
- Password: admin
You can reach the endpoints under the recipe. After choosing an operation, click the Try it out button. Then fill in the request body or parameters. After then click the Execute button. You can see the response in the response body box.
The project includes postman collection, which provides sample API requests. The postman collection is under the resources/postman directory. You can import the collection to your postman.
- Postman collection: https://github.com/yunussezgin/recipe-service/blob/dev/src/main/resources/postman/Recipe%20API.postman_collection.json
- Unit test data: https://github.com/yunussezgin/recipe-service/tree/dev/src/test/resources/data
API supports basic authentication. You can change user name and password on application.yml. Currently defined values the below.
- Username: admin
- Password: admin
You must send two keys/values with the header. “admin:admin” is equal “YWRtaW46YWRtaW4=” as Base64 encoded.
- Authorization: Basic YWRtaW46YWRtaW4=
- Content-Type: application/json;charset=utf-8