Getting Started
Installation
Add the ArianeGraphQL library to your project by including the following dependency in your build file:
- Groovy
- Kotlin
dependencies {
implementation 'com.arianegraphql:server:$arianeVersion'
implementation 'com.arianegraphql:server-ktor:$arianeVersion'
}
dependencies {
implementation("com.arianegraphql:server:${arianeVersion}")
implementation("com.arianegraphql:server-ktor:${arianeVersion}")
}
tip
It's also recommended to install the codegen plugin. See codegen plugin installation.
Usage
You can directly start the server like this:
- main.kt
- schema.graphqls
fun main() = arianeServer {
schema = loadSchema("schema.graphqls")
resolvers {
}
}.launch()
type Query {
movies: [Movie!]!
}
type Mutation {
addMovie(title: String!, directorName: String!): Movie!
}
type Movie {
title: String!
director: Director!
}
type Director {
name: String!
movies: [Movie!]
}
That's it!
Congratulations! You have a running GraphQL server. Let's now implement the resolvers.