A simple and efficient Task Management API built as a study project to explore the Ktor framework and Exposed ORM.
- Kotlin: Programming language.
- Ktor: Framework for building asynchronous servers and clients.
- Exposed: Kotlin SQL framework (ORM).
- H2 Database: Lightweight in-memory/file-based database.
- kotlinx.serialization: For JSON handling.
- Logback: For logging.
- List Tasks: Retrieve all tasks stored in the database.
- Create Task: Add new tasks with a title and description.
- Delete Task: Remove tasks using their unique ID.
- Database Persistence: Uses an H2 database with file storage.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Health check / Welcome message |
GET |
/tasks |
List all tasks |
POST |
/tasks |
Create a new task |
DELETE |
/tasks/{id} |
Delete a task by ID |
{
"title": "Learn Ktor",
"description": "Study how to build APIs with Kotlin and Ktor"
}{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Learn Ktor",
"description": "Study how to build APIs with Kotlin and Ktor",
"isDone": false
}src/main/kotlin:models/: Domain models (e.g.,Task).database/: Database configuration, tables (TaskTable), and DAOs.repositories/: Business logic and data access abstraction.Routing.kt: API route definitions.Application.kt: Application entry point and module configuration.
src/main/resources:application.yaml: Server and application configuration.logback.xml: Logging configuration.
-
Clone the repository:
git clone https://github.com/HarukaYamamoto0/study-ktor-server.git cd test
-
Run the application: Use the Gradle wrapper to run the server:
./gradlew run
-
Access the API: The server will start by default at
http://0.0.0.0:8080.
To run the tests, execute:
./gradlew testThis project was developed for study purposes.