Spring Webflux demo with Kotlin
Switch branches/tags
Nothing to show
Clone or download
Latest commit 519c962 Sep 1, 2017

README.adoc

This is a sample application demonstrating Spring 5 Webflux framework with endpoints written in a functional style

Run the App

./gradlew clean bootRun

Populate Data

Assuming that httpie is installed in your machine

http POST 'http://localhost:8080/messages' id="1" payload="one"
http POST 'http://localhost:8080/messages' id="2" payload="two"
http POST 'http://localhost:8080/messages' id="3" payload="three"

OR with CURL

curl -X "POST" "http://localhost:8080/messages" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d $'{
  "id": "1",
  "payload": "one"
}'

curl -X "POST" "http://localhost:8080/messages" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d $'{
  "id": "2",
  "payload": "two"
}'

curl -X "POST" "http://localhost:8080/messages" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d $'{
  "id": "3",
  "payload": "three"
}'

Query Data

Get Messages

http GET 'http://localhost:8080/messages'

OR with Curl

curl -X "GET" "http://localhost:8080/messages" \
     -H "Accept: application/json"

Get Message with an id

http GET 'http://localhost:8080/messages/1'
curl -X "GET" "http://localhost:8080/messages/1" \
     -H "Accept: application/json"

Delete Data

Delete Messages by id

http DELETE 'http://localhost:8080/messages/2'
curl -X "DELETE" "http://localhost:8080/messages/2" -H "Accept: application/json"