Skip to content

TatiSam/TasteItAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"Taste It" API

Java Spring Boot REST API Project

"Taste It" API contains information about the most loved and most popular dishes in different countries. In this API you will find information about the country that interests you and about those national dishes that you should definitely try there.

Architecture and Tech features

  • Written in Java Spring Boot
  • Spring Data JPA for working with database
  • Spring Security for authentication and access-control
  • BCrypt password encoder for encode password
  • JWT Token for authentication
  • Lombok to avoid writing repetitive Java code and/or boilerplate code
  • Spring Boot Validation to validate Data Access Objects in request
  • ModelMapper for Object mapping
  • Maven for dependency management and building project
  • H2 database for testing mode
  • MySQL database for production mode
  • Design Patterns: Singleton, Builder, Dependency Injection, Three Layer Architecture
  • TDD with integration testing
  • Amazon Web Servisec for storage database
  • Heroku for storage server side API

Pagination:

Request that return multiple items will be limited to 25 results by default. You can access other pages using the ?page paramater.

https://tasteit-api.herokuapp.com/api/1/countries/page?pageNo=0

Get Countries:

https://tasteit-api.herokuapp.com/api/1/countries/page

To get the Countries from the API, you can apply several filters using url parameters, the available options are listed below.

Param Type Default Example
pageNo number 0 ?pageNo=0
pageSize number 25 ?pageSize=10
sortBy id/name id ?sortBy=name
sortDir asc/desc asc ?sortDir=desc

Get Country by id:

https://tasteit-api.herokuapp.com/api/1/countries/1

Get Country by name:

https://tasteit-api.herokuapp.com/api/1/countries/name/slovenia

Get random Country:

https://tasteit-api.herokuapp.com/api/1/countries/random

Get dishes by Country id:

https://tasteit-api.herokuapp.com/api/1/countries/1/dishes

Get comments by Country id:

https://tasteit-api.herokuapp.com/api/1/countries/1/comments

Register user

https://tasteit-api.herokuapp.com/api/1/auth/signup

Method: Post

Request body:
{"userName": "your userName",
"email": "your email",
"password": "your password"}

Login user

https://tasteit-api.herokuapp.com/api/1/auth/login

Method: Post

Request body:
{"userNameOrEmail": "your userName or email",
"password": "your password"}

Post comment

https://tasteit-api.herokuapp.com/api/1/countries/{countryId}/comments

Method: Post

Header: "Authorization: Bearer yourBearerToken"

Request body:
{"name": "your name",
"email": "your email",
"body": "your comment"}

Edit comment

https://tasteit-api.herokuapp.com/api/1/comments/{commentId}

Method: Put

Header: "Authorization: Bearer yourBearerToken"

Request body:
{"name": "your name",
"email": "your email",
"body": "your edited comment"}

Delit comment

https://tasteit-api.herokuapp.com/api/1/comments/{commentId}

Method: Delete

Header: "Authorization: Bearer yourBearerToken"

Add rating

https://tasteit-api.herokuapp.com/api/1/countries/{countryId}/rating

Method: Post

Request body:
{"ip": "your ip",
"rating": your rating (number from 1 to 5)}

Add country to user preferences

https://tasteit-api.herokuapp.com/api/1/user/countries/{countryId}

Method: Post

Header: "Authorization: Bearer yourBearerToken"

Request body:
{"userNameOrEmail": "your userName or email"}

Delete country from user preferences

https://tasteit-api.herokuapp.com/api/1/user/countries/{countryId}

Method: Delete

Header: "Authorization: Bearer yourBearerToken"

Request body:
{"userNameOrEmail": "your userName or email"}

Get list of countries from user preferences

https://tasteit-api.herokuapp.com/api/1/user/countries?userNameOrEmail={yourUserNameOrEmail}

Method: Get

Header: "Authorization: Bearer yourBearerToken"

Add dish to user preferences

https://tasteit-api.herokuapp.com/api/1/user/dishes/{dishId}

Method: Post

Header: "Authorization: Bearer yourBearerToken"

Request body:
{"userNameOrEmail": "your userName or email"}

Delete country from user preferences

https://tasteit-api.herokuapp.com/api/1/user/dishes/{dishId}

Method: Delete

Header: "Authorization: Bearer yourBearerToken"

Request body:
{"userNameOrEmail": "your userName or email"}

Get list of dishes from user preferences

https://tasteit-api.herokuapp.com/api/1/user/dishes?userNameOrEmail={yourUserNameOrEmail}

Method: Get

Header: "Authorization: Bearer yourBearerToken"

Author

Tatiana Samoilenko

tatismoilenko@gmail.com

Israel

TODO

  • Get Country By Name - done
  • Get Random Country - done
  • Get Countries By Сontinent
  • Get All Dishes
  • Get Random Dish
  • To fill Database