Build Restful CRUD API for a blog using Spring Boot, Mysql, JPA and Hibernate.
1. Clone the application
git clone https://github.com/binhnt174/api.git
2. Create Mysql database
create database work
3. Change mysql username and password as per your installation
- open
src/main/resources/application.properties
- change
spring.datasource.username
andspring.datasource.password
as per your mysql installation
4. Run the app using maven
mvn spring-boot:run
The app will start running at https://localhost:8080
The app defines following CRUD APIs.
Method | Url | Decription | Sample Valid Request Body |
---|---|---|---|
GET | /api/list/{page} | list work | |
POST | /api/add | add list work | |
POST | /api/update | update list work | |
POST | /api/delete | delete work |
{
"listWork02Dto":
[
{
"workName": "Coding",
"status": "DOING",
"startDt": "2022-05-31T17:00:00.000+00:00",
"endDt": "2022-06-01T17:00:00.000+00:00"
}
]
}
{
"listWork01Dto":
[
{
"workId": 1,
"workName": "Coding",
"status": "DOING",
"startDt": "2022-05-31T17:00:00.000+00:00",
"endDt": "2022-06-01T17:00:00.000+00:00"
}
]
}
{
"listDel":[7,8]
}