Movie Rental Shop API in Spring boot
- Clone the repository
- Create database in MySQLWorkBench
- Config Spring Data Source in
application.properties
default configuration
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url=jdbc:mysql://localhost:3306/movie_shop?useSSL=false
spring.datasource.username=shop_manager
spring.datasource.password=
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto=update
- Run application
URL : /
Method : GET
Success Response
Response example
[
{
"id": 1,
"movieName": "The Avengers",
"amountInStock": 10,
"dayToRent": 7
},
{
"id": 2,
"movieName": "Spider-Man : Far From Home",
"amountInStock": 10,
"dayToRent": 7
}
]
URL : /add
Method : POST
Success Response
Body example
{
"movieName": "The Incredible Hulk",
"amountInStock": 10,
"dayToRent": 7
}
Response example
Add Movie Complete
URL : /rent/{id}
Method : GET
Success Response
Response example
rent complete
URL : /return/{id}
Method : GET
Success Response
Response example
return complete