-
Java 8 (This demo will not run with any Java < 8)
-
HAL (Hypertext Application Language)
-
Atmosphere (Async Pub/Sub)
-
Jersey (JAX-RS reference implementation)
-
Spring Boot (+ Data, REST, HATEOAS)
-
TypeScript for web client
-
AngularJS for web client
-
Protractor for functional web client UI tests
-
JUnit for Java unit and integration testing
-
Mockito for Mocking
-
Gradle as build system
-
Docker to create containers for the running apps
-
Java 8 JDK installed
-
Node.js installed
-
Grunt CLI installed (npm install -g grunt-cli)
-
Bower and TSD (TypeScript Definition Manager) don’t have to be installed, the build will invoke the grunt contribs for bower and tsd
-
./gradlew build (builds all and runs the integration tests, both Java and TypeScript)
-
./gradlew startServerSync (starts a Jetty server using port 8080)
-
Open http://localhost:8080/src/main/webapp/chatty.html in a web browser
-
Open http://localhost:8080/src/main/webapp/chatty.html in another web browser
-
Play around with chatty!
Here is an example what you get at http://localhost:8080/chatty/api/users. Currently I am using HAL. The returnd mime type is application/hal+json. To get a pretty print in Chrome, please install the Chrome extensions JSONView and application/…+json|+xml as inline.
{
"_links": {
"self": {
"href": "http://localhost:8080/chatty/api/users",
"hreflang": "en",
"profile": "chatty"
}
},
"_embedded": {
"users": [
{
"_links": {
"self": {
"href": "http://localhost:8080/chatty/api/users/toedter_k"
}
},
"email": "kai@toedter.com",
"fullName": "Kai Toedter",
"id": "toedter_k"
}
]
}
}To run the Spring-Boot based server, invoke gradlew bootrun
Then you can use http://localhost:8080/chatty/api/ as entry point for exploring the HAL based API.
{
"_links" : {
"chatty:users" : {
"href" : "http://localhost:8080/chatty/api/users{?page,size,sort,projection}",
"templated" : true
},
"chatty:messages" : {
"href" : "http://localhost:8080/chatty/api/messages{?page,size,sort,projection}",
"templated" : true
},
"profile" : {
"href" : "http://localhost:8080/chatty/api/alps"
},
"curies" : [ {
"href" : "http://localhost:8080/chatty/api/alps/{rel}",
"name" : "chatty",
"templated" : true
} ]
}
}After having started the Spring Boot based server, you can use http://localhost:8080/chatty/api/hal-browser/browser.html#/api/ as entry point for exploring the HAL based API with the embedded HAL-Browser.
Currently the Spring Boot based server is deployed to Heroku. You can browse the Chatty API with the HAL browser at https://chatty42.herokuapp.com/hal-browser/browser.html#https://chatty42.herokuapp.com/chatty/api. You can also try out a live demo of chatty at https://chatty42.herokuapp.com/chatty/chatty.html. But please be aware that this is only a test installment and will be reset periodically.
For the gradle docker integration the gradle-docker-plugin is used.
You find installation instructions at Docker. When you use Windows or MAC, install boot2docker. Then start Docker.
Open a new console and run the following
cd subprojects/com.toedter.chatty.server gradle dockerBuildImage
After successful image creation, you will see an image id. In the Docker console, type
docker images
You will see the newly created image. Then run the image:
ID=$(docker run -d -p 8080:8080 <imageId>)
Open a browser with the Docker IP address and Port 8080, e.g. http://192.168.59.103:8080/src/main/webapp/chatty.html
finally stop the container:
docker stop $ID
MIT, see http://toedter.mit-license.org