Skip to content

Latest commit

 

History

History

ktor-server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

GraphQL Kotlin Ktor

Ktor is an asynchronous framework for creating microservices, web applications, and more.

Running locally

Build the application by running the following from examples root directory:

# build example
./gradlew ktor-server:build

NOTE: in order to ensure you use the right version of Gradle we highly recommend that you use the provided wrapper scripts

Start the server by running Application.kt directly from your IDE. (Make sure that your Kotlin Compiler jvm target is 1.8 or greater.) Alternatively, you can start the server using Gradle.

cd /path/to/graphql-kotlin/examples
./gradlew ktor-server:run

Once the app has started you can:

Example query

You can use the following example query to view several of the related models:

query {
  searchCourses(params: { ids: [1,2,3] }) {
    id
    name
    books {
      title
    }
    university {
      id
      name
    }
  }

  searchUniversities(params: { ids: [1]}) {
    id
    name
  }
}

You can also query the longThatNeverComes field from several of the types. This will throw and exception, allow you to see how the ExecutionStrategy handles throw exceptions in different levels of the query.