https://github.com/babyfish-ct/graphql-kotlin-example
GraphQL server-side example by using graphql-kotlin(https://github.com/ExpediaGroup/graphql-kotlin) with data loader
https://github.com/babyfish-ct/graphql-kotlin-example
Last synced: 6 months ago
JSON representation
GraphQL server-side example by using graphql-kotlin(https://github.com/ExpediaGroup/graphql-kotlin) with data loader
- Host: GitHub
- URL: https://github.com/babyfish-ct/graphql-kotlin-example
- Owner: babyfish-ct
- Created: 2020-03-22T13:13:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-20T22:44:19.000Z (over 3 years ago)
- Last Synced: 2025-04-03T06:24:08.256Z (6 months ago)
- Language: Kotlin
- Homepage:
- Size: 142 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A GraphQL server-side example by using graphql-kotlin(https://github.com/ExpediaGroup/graphql-kotlin) with data loader
This is server-side demo for JVM, please visit https://github.com/babyfish-ct/graphql-csharp-example to see the server-side demo for .NET Core.
# Start server
1. Download or 'git clone' this project
2. Startup this spring-boot application
+ If you want to run it by Intellij, import this project, then open 'src/main/kotlin/com/citicguoan/training/App.kt' and run it
+ If you want to run it by command line, use "mvn spring-boot:run", or "mvn clean install" and" java -jar target/app.jar"3. Open your browser, access http://localhost:8080/playground
The query operations can be used by everyone, but the mutation operations can only be used by the authorized user.
You can execute the mutation operations like thisa. Execute the query to get the token
```
query {
login(loginName: "admin", password: "123") {
token
}
}
```
The response should be
```
{
"data": {
"login": {
"token": "<>"
}
}
}
```
Copy the <<token text>> to clipboardb. Enter mutation operation
c. Use the token the execute mutation exception
There is a button whose text is 'HTTP HEADERS' on the query operations UI of playgound,
click it, a textarea that is used to edit http headers will appear, edit it like this```
{
"Authorization": "<>"
}
```
Then the mutation operation can be execute successfully.# Start client
please see http://github.com/babyfish-ct/graphql-react-example to know more