Skip to content

royclarkson/spring-rest-todos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

22dde7b · Oct 21, 2014

History

97 Commits
Jul 30, 2014
Oct 21, 2014
Mar 13, 2014
Mar 12, 2014
Mar 12, 2014
Aug 15, 2014
Oct 21, 2014
Apr 1, 2014
Mar 12, 2014
Mar 12, 2014

Repository files navigation

Spring REST Todos

Build Status

A simple todo list example built with Spring

Build and Run

NOTE: This project now depends on org.springframework:spring-sync:0.5.0.RELEASE. This project is not (yet) in any known Maven repository. Therefore, you'll need to clone it from https://github.com/habuma/spring-sync and do 'gradle build install' to get it into your local repository.

./gradlew clean build bootRun

Test

The following curl commands can be used to test the API.

Request the list of todos:

curl -X "GET" -v localhost:8080/todos

Add a new todo:

curl -X "POST" -v localhost:8080/todos -H "Content-Type: application/json" -d '{"description":"A Todo","complete":false}'

Modify an existing todo:

curl -X "PUT" -v localhost:8080/todos/0 -H "Content-Type: application/json" -d '{"description":"Modified Todo","complete":false}'

Delete a todo:

curl -X "DELETE" -v localhost:8080/todos/0

Apply a JSON PATCH to the todo list:

curl -X "PATCH" -v localhost:8080/todos -H "Content-Type: application/json" -d '[{"op":"replace","path":"/0/description","value":"go go go!"}]'

Generate a JSON PATCH from a modified todo list:

curl -X "POST" -v localhost:8080/todos/diff -H "Content-Type: application/json" -d '[{"description":"go go go!","complete":false},{"description":"b","complete":false}]'

Run the Web Client

Setup

npm install -g bower
cd public
bower install

Open in Browser

Go to http://localhost:8080/index.html