/jetbrains-sample

Toy Project built with Ktor, Exposed, and kotlinx-serialization

Primary LanguageKotlinApache License 2.0Apache-2.0

Jetbrains Sample

Toy Address Book project built with Ktor, Exposed, and kotlinx-serialization.

Requirements

  • Java 11

No database server is necessary; H2 is bundled, and can be configured for file or memory mode.

Serve the API

There are a few optional environment variables:

  • PORT: default 8080
  • DB_IN_MEMORY: [true, false], default true
  • DB_NAME: default ./addressBook
$ sh gradlew run

API Routes

Operation Method Path Inputs Outputs
ListCustomers GET /v1/customers - name: String (query, optional)
- email: String (query, optional)
- List (body)
GetCustomer GET /v1/customers/{id} - id: UUID (path) - CustomerDtoV1 (body)
SaveCustomer POST /v1/customers - CustomerDataDtoV1 (body) - CustomerDtoV1 (body)

Run Tests

$ sh gradlew check

Package Uber Jar

$ sh gradlew shadowJar