nixos89 / todo-kotlin-java-app

ToDo RESTful app written in Java and Kotlin using Flyway as migration DB tool for PostgresDB 12

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kotlin-Java Demo ToDo app

Simple ToDo app containing REST API written in Java and Kotlin using:

  • Spring Data JPA
  • Flyway Migration Tool
  • PostgresDB 12 (scripts)
  • JUnit5

1. Setting up and running the app

To properly set up and run the app perform following steps:

  1. Create todo_db database in Postgres DB ver 12 using following credentials: username=postgres
    password=postgres
    NOTE: Make sure they are matching spring.datasource.username / spring.flyway.user properties in application.properties file
  2. Enter directory of todo-kotlin-java-app module
  3. Make sure property spring.flyway.enabled is set to true located in src/main/resources/application.properties
  4. Execute ./gradlew bootRun command
  5. Before 2nd and every other app run (i.e. before executing Step4) set spring.flyway.enabled property to false located in src/main/resources/application.properties

2. App containerization

If you prefer not to have needed Postgres 12 version installed on your computer locally you can run docker-compose. In that use case you need to:

  1. Disable port 5432 in order for containerized Postgres image to run
  2. Create docker network named app_db_net.

Finally, execute docker compose up -d command to start both application and database containers.

3. REST Endpoints

Target one of following endpoints

  1. GET all Todo(s) http://localhost:8080/api/todos
  2. GET Single Todo (with id=1) http://localhost:8080/api/todos/1
  3. POST Todo http://localhost:8080/api/todos
    ...using following body
   {
      "title": "Kotlin app review",
      "description": "Survive the Kotlin app review"
   }
  1. PATCH Todo http://localhost:8080/api/todos/3
    ...using following body
    {
        "title": "Push created Kotlin project!!!"
    }
  1. DELETE Todo http://localhost:8080/api/todos/2

About

ToDo RESTful app written in Java and Kotlin using Flyway as migration DB tool for PostgresDB 12


Languages

Language:Kotlin 85.3%Language:Mustache 7.2%Language:Java 4.0%Language:Dockerfile 3.5%