Skip to content

yunussezgin/recipe-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recipe Management API

The web application allows users to manage your favorite recipes.

Recipe API Specification Document: Download

Recipe API Technical Document: Download

Required tools to run the API

  • 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)

Running the Recipe API

1. Running on your PC

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 Login Console

Run the below commands at the root of the project directory. You can also do the below on your IDE.

Build Recipe API using maven.

mvn clean install

Run spring boot application.

mvn spring-boot:run

2. Running on Docker

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.

Run the below commands at the root of the project directory.

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

Invoke the Recipe API

1. Invoke with Swagger UI

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.

SwaggerUI

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.

SwaggerUIRequest

SwaggerUIResponse

2. Invoke with Postman

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

API supports basic authentication. You can change user name and password on application.yml. Currently defined values the below.

  • Username: admin
  • Password: admin

PostmanAuthorization

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

PostmanHeaders

About

API allows users to manage their favorite recipes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published