Skip to content

crl-n/ktor-to-do-list

Repository files navigation

Ktor Todolist

A humble Todolist api. Kotlin, Ktor, Koin, PostgreSQL, Redis, Gradle, Flyway, Test Containers and more.

Running the API

Database setup

Create a Postgres instance using Docker CLI:

docker run --detach --rm \
  --name postgresql-ktor-to-do-list \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_DB=todolist \
  -p 127.0.0.1:5432:5432 \
  postgres:17.1

The command above is also available as a Gradle task:

./gradlew runPostgresOnce

Cache setup

Create a Redis instance using Docker CLI:

docker run --detach --rm \
  --name redis-ktor-to-do-list \
  -p 6379:6379 \
  redis:7.4.1

You can examine the cache by connecting to the Redis instance:

docker exec -it redis-ktor-to-do-list redis-cli

Build

./gradlew build

Run

Ensure database is up and running, then execute:

./gradlew run

Test

Note that tests use Test Containers and therefore rely on Docker.
Ensure that Docker is up and running, then execute:

./gradlew test

Example Requests

You can find example requests for testing the api in REQUESTS.md.

About

A humble todo list API made with Ktor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published