kotlin-ktor-crud-rest-api
Simple CRUD Rest API in Kotlin
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.6%) to scientific vocabulary
Repository
Simple CRUD Rest API in Kotlin
Basic Info
- Host: GitHub
- Owner: MikAoJk
- License: mit
- Language: Kotlin
- Default Branch: main
- Size: 271 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
kotlin-ktor-crud-rest-api
Simple application to showcase a CRUD Rest API application in Kotlin
Technologies used
- JDK 21
- Kotlin
- Gradle
- Docker
- Ktor
- Postgres
- Curl
Prerequisites
Make sure you have the Java JDK 21 installed
You can check which version you have installed using this command:
bash script
java -version
Docker
Make sure you have docker installed using this command:
bash script
docker --version
Curl
Make sure you have curl installed using this command:
bash script
curl --version
Running the application locally
Build code
Build the code without running it
bash script
./gradlew installDist
Test code
Run all the tests
bash script
./gradlew test
Running the application locally
Create docker image of the kotlin app
Creating a docker image should be as simple as
bash
docker build -t kotlinktorapp .
👟 Run all the needed services and the application
bash script
docker compose up
🧪 Test the applications endpoints
Request to get the all the users:
bash script
curl --location --request GET 'http://localhost:8080/users'
Example of a response:
[
{
"id": 1,
"name": "aaa",
"email": "aaa@mail"
},
{
"id": 2,
"name": "bbb",
"email": "bbb@mail"
}
]
Request to create a new user
bash script
curl --location --request POST 'http://localhost:8080/user' \
--header 'Content-Type: application/json' \
--data-raw '{"name": "aaa","email": "aaa@mail"}'
Request to get one specific user:
bash script
curl --location --request GET 'http://localhost:8080/user/2'
Example of a response:
{
"id": 1,
"name": "new",
"email": "new@mail"
}
Request to update a user
bash script
curl --location --request PUT 'http://localhost:8080/user/2' \
--header 'Content-Type: application/json' \
--data-raw '{"id":2,"name": "new","email": "new@mail"}'
Request to delete a user
bash script
curl --location --request DELETE 'http://localhost:8080/user/3'
Api documentation
The api documentation is available here
NOTE: The application has to be running
http://localhost:8080/openapi
Upgrading the gradle wrapper
Find the newest version of gradle here: https://gradle.org/releases/ Then run this command:
NOTE: Remember to replace $gradleVersjon with the newest version of gradle
shell script ./gradlew wrapper --gradle-version $gradleVersjon
Contribute
Want to add a feature or just some other improvements? see CONTRIBUTING
Contact
This project is maintained by CODEOWNERS
Questions? please create an issue
Owner
- Name: Joakim Taule Kartveit
- Login: MikAoJk
- Kind: user
- Location: Norway
- Company: @navikt
- Website: https://mikaojk.github.io/
- Repositories: 61
- Profile: https://github.com/MikAoJk
Software developer, passionate about coding simple applications
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "kotlin-ktor-crud-rest-api"
authors:
- family-names: "Kartveit"
given-names: "Joakim"
orcid: ""
affiliation: ""
date-released: "2025-01-08"
version: "main"
repository-code: "https://github.com/MikAoJk/kotlin-ktor-crud-rest-api"
license: "MIT"
url: "https://github.com/MikAoJk/kotlin-ktor-crud-rest-api"
abstract: "Simple CRUD Rest API in Kotlin built with Ktor."
GitHub Events
Total
- Issues event: 3
- Delete event: 58
- Issue comment event: 56
- Push event: 82
- Pull request event: 99
- Create event: 60
Last Year
- Issues event: 3
- Delete event: 58
- Issue comment event: 56
- Push event: 82
- Pull request event: 99
- Create event: 60
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 2
- Total pull requests: 59
- Average time to close issues: about 6 hours
- Average time to close pull requests: about 2 hours
- Total issue authors: 1
- Total pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.58
- Merged pull requests: 44
- Bot issues: 0
- Bot pull requests: 55
Past Year
- Issues: 2
- Pull requests: 59
- Average time to close issues: about 6 hours
- Average time to close pull requests: about 2 hours
- Issue authors: 1
- Pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.58
- Merged pull requests: 44
- Bot issues: 0
- Bot pull requests: 55
Top Authors
Issue Authors
- MikAoJk (2)
Pull Request Authors
- dependabot[bot] (46)
- github-actions[bot] (6)
- MikAoJk (4)