Skip to content

com.restfql.ktor-restfql 1.0.5 Latest version

Install 1/2: Add this to pom.xml:
Learn more about Maven or Gradle
<dependency>
  <groupId>com.restfql</groupId>
  <artifactId>ktor-restfql</artifactId>
  <version>1.0.5</version>
</dependency>
Install 2/2: Run via command line
$ mvn install

About this package

LogoMakr-0suVuk Ktor RestFQL

Motivation

RestFQL for ktor is a rest middleware that implements the specification.

In short RestFQL allows filtering of response driven by the querying side without breaking caching and keeping the capability for the backend to do optimizations as required.

Usage

  1. 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")
        }
    }
}
  1. install with a package manager
val restfql_version = "1.0.0"

dependencies {
    implementation("com.restfql:ktor-restfql:$restfql_version")
}
  1. 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)
}
  1. query passing the model as a query param call fql

preview query