/kotlin-spring-boot-hateoas-database

Kick the tires on Spring Boot HATEOAS with a database

Primary LanguageShellThe UnlicenseUnlicense

Public Domain

Kotlin Spring Boot HATEOAS Database

build issues pull requests vulnerabilities license

Kick the tires on Spring Boot HATEOAS with a database. (Do not fret, this project uses an in-memory database that vanishes when you stop the program.)

Caveat emptor

This is a scratch, experimental repository. It might force push. It might be renamed without warning. It might vanish without warning.

How to use

First, ensure your clone builds cleanly:

$ ./mvnw clean verify

If satisfied, try running the program. In a first terminal, execute:

$ ./mvnw spring-boot:run
# Or with Docker
$ ./batect run

Once the program is ready (look for the "Started HateoasApplicationKt" message), in another terminal (if you don't use curlie or httpie, try curl or telnet though it will not be as nice to look at):

# Output: list of data endpoints
$ http localhost:8080/data
# Output: description of the AUTHORS database table
$ http localhost:8080/data/authors
# Output: first record in AUTHORS (Joanne Rowling is moby, is she not?)
$ http localhost:8080/data/authors/author-1
# Output: the first author in the database
$ http localhost:8080/rest/authors/author-1
# Output: the first author as GraphQL
$ http :8080/graphql query='{
  bookById(id: "book-1") {
    id
    title
    pageCount
    moby
    author {
      id
      firstName
      lastName
    }
  }
}'
# Output: all available endpoints
$ http localhost:8080/rest
# Output: list of admin endpoints
$ http localhost:8080/admin
# Output: everything should be in the UP state
$ http localhost:8080/admin/health

Before interrupting the first terminal process, try the data link again. Play around with the web page features. You cannot break anything (the database is in-memory). Sadly, there is no nice page for the admin links.

Before you change to another task, please interrupt the first terminal, and shutdown the demonstration.

Features

Pretty, auto-configured/auto-generated UI explorers

In-memory persistence for demo

Additional Spring Boot features

Tracing/debugging from IDE

Run the program configured with JVM debugging. This configured in batect.yml for the standard port of 5005, and run as:

$ ./batect debug

Attach the remote debugging facility of your IDE to this port.

TODO