I tried to implement Restful API using Spring Boot. Source code: https://github.com/unhurried/spring-boot-rest-api
The libraries used are as follows.
/src/main/resources/application.yaml
./sql/create.sql
to create the DB schema.File
→ Import
→ Existing project to workspace
Run
→ Spring Boot Application
API to perform CRUD operation for ToDo resource is implemented.
# Create a ToDo item.
$ curl --request POST \
> --url http://localhost:8080/example/api/todos \
> --header 'Content-Type: application/json' \
> --data '{"title":"Test","content":"This is a test.","date": "2018-06-01"}' \
> --include
HTTP/1.1 200
Content-Type: application/json
Content-Length: 71
{"id":1,"title":"Test","content":"This is a test.","date":"2018-06-01"}
Recommended Posts