Ktor
Usage
- Add repository if not use the version on maven central
repositories {
...
maven {
url = uri("https://maven.pkg.github.com/restfql/ktor-restfql")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
- install with a package manager
val restfql_version = "1.0.0"
dependencies {
implementation("com.restfql:ktor-restfql:$restfql_version")
}
- Add the middleware to your ktor server
package com.restfql.ktor.example
import com.restfql.ktor.RestFQL
import io.ktor.server.application.*
import io.ktor.server.netty.*
import com.restfql.ktor.example.plugins.*
fun main(args: Array<String>) {
EngineMain.main(args)
}
fun Application.module() {
...
install(RestFQL)
}
- query passing the model as a query param call
fql