crnk example application

Build Status Gitter License

This is a Spring-based showcasing the use of Crnk. Further smaller example applications integrating into various frameworks can be found at crnk-integration-examples.

WARNING: this example project is still in development and subject to various improvements, see roadmap

Requirements

Crnk requires Java 8 or later.

Licensing

Crnk is licensed under the Apache License, Version 2.0. You can grab a copy of the license at http://www.apache.org/licenses/LICENSE-2.0.

Building from Source

Crnk make use of Gradle for its build. To build the project run

gradlew build

Running the application

In order to run this example do:

gradlew run

or

docker run --name=crnk -p 8080:8080 crnk/example

The JSON API endpoint will be available at:

http://localhost:8080/api/

Some further URLs to play around that show the power of Crnk:

http://127.0.0.1:8080/api/movie
http://127.0.0.1:8080/api/movie/44cda6d4-1118-3600-9cab-da760bfd678c
http://127.0.0.1:8080/api/movie/44cda6d4-1118-3600-9cab-da760bfd678c
http://127.0.0.1:8080/api/movie/44cda6d4-1118-3600-9cab-da760bfd678c/project
http://127.0.0.1:8080/api/movie/44cda6d4-1118-3600-9cab-da760bfd678c/relationships/project
http://127.0.0.1:8080/api/movie?sort=-name
http://127.0.0.1:8080/api/movie?sort=-id,name
http://127.0.0.1:8080/api/movie?sort=id&page[offset]=0&page[limit]=2
http://127.0.0.1:8080/api/movie?filter[name]=Iron Man
http://127.0.0.1:8080/api/movie?filter[name][EQ]=Iron Man
http://127.0.0.1:8080/api/movie?filter[name][LIKE]=Iron
http://127.0.0.1:8080/api/schedule
http://127.0.0.1:8080/api/meta/resource
http://127.0.0.1:8080/api/vote?fields=name // demos fields set & performance issues
http://127.0.0.1:8080/api/secrets // demos error
http://127.0.0.1:8080/api/facet?filter[resourceType]=movie // get movie facets

IDE

Make sure to enable annotation processing support when using IntelliJ IDEA. Otherwise it will not be able to find the generated sources from the Crnk annotation processor (type-safe Query objects).

Build Setup

The project makes use of https://github.com/rmee/gradle-plugins/ for the build setup.

Pointers

The crnk-example-service project showcases:

The TestDataLoader will automatically setup some test data upon start.

The project itself makes use of an number of third-party plugins to bootstrap a JDK, build Helm packages and allow a Kubernetes installation to Google Cloud. For more information see https://github.com/rmee/gradle-plugins/.

Feedback and PRs very welcomed!

Links