From dd3a8cac1902f9f77f6fa8bbf9715301cee9fa48 Mon Sep 17 00:00:00 2001 From: herrrta <@> Date: Tue, 19 Nov 2024 17:58:56 -0500 Subject: [PATCH] # Update readme --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ba48b1f..ff0e4cd 100644 --- a/README.md +++ b/README.md @@ -1 +1,73 @@ -# ktorceful \ No newline at end of file +[![Maven metadata URL](https://img.shields.io/maven-central/v/dev.herrrta.ktorceful/core)](https://repo.maven.apache.org/maven2/dev/herrrta/ktorceful/) +![GitHub License](https://img.shields.io/github/license/herrrta/ktorceful) + +# Ktorceful +A simple solution to easily create reusable class based routing. + +Avoid needing to type out repetitive routing dsl! + +```kotlin +// Create your class based view to handle all your required HTTP methods +@Resource("user") +class UserRoute: Get, Post, Delete { + override suspend fun get(call: RoutingCall) { + // ... + } + + override suspend fun post(call: RoutingCall) { + // ... + } + + override suspend fun delete(call: RoutingCall) { + // ... + } +} + + +fun Application.module() { + install(Resources) + // ... + + // Create routing using the included functions + createBasicRoute() +} +``` + +Any future changes to your route can all be done within your class! + + + +## Setup +Add ktorceful-core dependency to your application + +```kotlin +dependencies { + implementation("dev.herrrta.ktorceful:core:x.x.x") + + // OPTIONAL! if using authentication in ktor + implementation("dev.herrrta.ktorceful:auth:x.x.x") +} +``` + + +### If you are using version catalogs: + +```toml +[versions] +ktorceful = "x.x.x" +... + +[libraries] +ktorceful-core = { module = "dev.herrrta.ktorceful:core", version.ref = "ktorceful" } + +# OPTIONAL! if using authentication in ktor +ktorceful-auth = { module = "dev.herrrta.ktorceful:auth" } +... +``` + +```kotlin +dependencies { + implementation(libs.ktorceful.core) + implementation(libs.ktorceful.auth) +} +```