Based on Template for Spring Boot application
Includes a web server on port 9080 with /articles endpoint.
Supports CRUD and cursor-based list pagination (prev / next).
- Maven 3
- JDK 21
mvn clean install
docker build ./ -t client-cursor-app
Use run.bat or:
java -jar target/client-cursor-0.0.1-SNAPSHOT.jar \
--spring.datasource.url=jdbc:h2:mem:testdb \
--spring.datasource.username=sa \
--spring.datasource.password=password \
--spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
Or with Docker Compose:
docker-compose up
- API: http://localhost:9080/articles
- Swagger: http://localhost:9080/swagger-ui/index.html
- Presentation (Marp slides): docs/README.md
curl -i -H "Accept: application/json" -H "Content-Type: application/json" \
-d '{ "title": "Some title", "text": "Some text", "author": "Jane Doe" }' \
-X POST http://localhost:9080/articles
curl -i http://localhost:9080/articles/1
curl -i -H "Accept: application/json" -H "Content-Type: application/json" \
-d '{ "title": "Another title" }' \
-X PATCH http://localhost:9080/articles/2
curl -i 'http://localhost:9080/articles?size=2'
Response shape: {"data":[...], "prev":..., "next":...}
Pass next / prev as cursor in the next request:
curl -i 'http://localhost:9080/articles?size=2&cursor=PUT_NEXT_OR_PREV_CURSOR_HERE'
Optional sorting on the first request only:
curl -i 'http://localhost:9080/articles?size=2&sort_by=title&sort_order=ASC'
sort_by:title|author|summarysort_order:ASC|DESC(defaultASC)- After the first page, sort is taken from the cursor — do not pass
sort_bytogether withcursor previsnullon the first page;nextisnullon the last page
curl -i -X DELETE http://localhost:9080/articles/1
App must be running on port 9080, then:
run-func-tests.bat