Skip to content

MichaelKaaden/redux-server-spring

Repository files navigation

Redux Server (Spring Boot Edition)

GitHub last commit GitHub issues license

This is a tiny REST service managing counters. The counters are kept in memory, so they are reset every time you restart the service.

Each counter has

  • a unique index (a number greater or equal 0) and
  • a value.

You can either get or set a counter. Of course, you shouldn't set any counter in a distributed environment. Instead, you should get it and then use the increment or decrement operations on it. For presentations, it is a reasonable choice to set some counters before showing anything to your audience.

The RESTful Web Service runs at http://localhost:3000. Its Swagger UI is available at http://localhost:3000/swagger-ui/index.html and the OpenAPI description is available at http://localhost:3000/v3/api-docs.

Running the service

$ ./gradlew bootRun

Test

$ ./gradlew test

For the HTML report, see the directory build/reports/tests/test.

Code Coverage (with JaCoCo)

This is generated everytime the unit tests are run. To do this separately:

$ ./gradlew jacocoTestReport

As usual, you'll find the HTML report in the directory build/reports/jacoco/test.

Building and Running the Docker Image

$ ./gradlew build
$ docker build -t myorg/redux-server-spring .
$ docker run --rm -p 3000:3000 myorg/redux-server-spring

On my Mac, the image size is 433 MB, the container uses 228 MB RAM.

Building and Running a Native Image

To build a native image, you have to have GraalVM installed, the environment variable GRAALVM_HOME set and Docker (or something compatible like Rancher Desktop) running on your host. For details, please see the documentation.

$ ./gradlew bootBuildImage
$ docker run --rm -p 3000:3000 docker.io/library/redux-server-spring:0.0.1-SNAPSHOT

On my Mac, the image size is 129 MB, the container uses 146 MB RAM.

Dependency Updates

To check for dependency updates, please use

$ ./gradlew dependencyUpdates

Alternative and Corresponding Implementations

This is only one possible solution to this kind of problem.

There are some implementations of single-page applications using the services which are implemented in different programming languages and frameworks.

Here's the full picture.

Client-Side Implementations

Server-Side Implementations

About

A tiny REST service managing counters using Spring Boot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published