https://github.com/thesurlydev/kotlin-minimal-example
An example CRUD API using kotlin-minimal-server
https://github.com/thesurlydev/kotlin-minimal-example
Last synced: about 1 year ago
JSON representation
An example CRUD API using kotlin-minimal-server
- Host: GitHub
- URL: https://github.com/thesurlydev/kotlin-minimal-example
- Owner: thesurlydev
- Created: 2024-08-10T18:26:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-15T22:54:21.000Z (over 1 year ago)
- Last Synced: 2025-02-15T23:27:54.740Z (over 1 year ago)
- Language: Kotlin
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kotlin-minimal-example
An example of using [kotlin-minimal-server](https://github.com/thesurlydev/kotlin-minimal-server) for a simple CRUD API over HTTP/JSON.
## Goals
* Minimal annotations - just one: @Serializable
* Minimal dependencies
* No reflection
## Dependencies
* [kotlin-minimal-server](https://github.com/thesurlydev/kotlin-minimal-server)
* [kotlin-minimal-rdms](https://github.com/thesurlydev/kotlin-minimal-rdms)
* db driver
* kotlinx.serialization - for JSON serialization without reflection
## Compile and Package
```shell
./gradlew clean build
```
## Run
```shell
java -jar build/libs/kotlin-minimal-example-0.1.0-standalone.jar
```
## Database
To effectively reset the database:
```shell
docker compose down -v
rm -rf data
mkdir -p data/db
docker compose up -d
```
The `*.sql` files get run in natural order which is why they're prefixed.
The custom `pg_hba.conf` is necessary when using colima on Apple Silicon.