Skip to content

Kotlin + Spring Boot + JPA starter (using containerized Postgres)

Notifications You must be signed in to change notification settings

helloworldless/kotlin-spring-boot-jpa-starter

Repository files navigation

Kotlin + Spring Boot + JPA Starter

Running Locally

  1. Make sure Postgres is running locally with default settings (see instructions below)
  2. Run com/davidagood/kotlinspringbootjpa/KotlinSpringBootJpaStarterApplication.kt or run ./gradlew bootRun
  3. Starts @ http://localhost:8080
  4. Supports basic CRUD operations:
    1. GET /relation
    2. POST /relation?parent=<parentId>&child=<childId>
    3. DELETE /relation
  5. Supports seeding an arbitrary number of relations: POST /seed/{count}

Build

Run ./gradlew build

Running Postgres with Docker

  • docker run -d --name kotlin-sb-jpa-starter -v kotlin-sb-jpa-starter-data:/var/lib/postgresql/data -p 5432:5432 postgres:latest
  • docker logs -f kotlin-sb-jpa-starter
  • docker exec -it kotlin-sb-jpa-starter psql -U postgres
    • \l to list databases
    • CREATE DATABASE test;
    • \c test to change to test database
    • INSERT INTO relation(id, parentId, childId) VALUES (2, 2, 3);
    • INSERT INTO relation(id, parentId, childId, createdAt) VALUES (1, 1, 2, timezone('UTC'::text, now()));
    • SELECT * FROM relation;

About

Kotlin + Spring Boot + JPA starter (using containerized Postgres)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published