Spring Graphql Samples

Spring Graphql Reactive Samples With Jwt Authentication

Spring Boot Graphql Samples

Graphql

GraphQL is a query language and server-side runtime for application programming interfaces (APIs) that prioritizes giving clients exactly the data they request and no more. GraphQL is designed to make APIs fast, flexible, and developer-friendly. It can even be deployed within an integrated development environment (IDE) known as GraphiQL. As an alternative to REST, GraphQL lets developers construct requests that pull data from multiple data sources in a single API call.

Prerequisites

  • Java 17
  • Kotlin
  • Maven 3.x

Build

You can install the dependencies and build by typing the following command

mvn clean install

Testing

You can run application’s tests by typing the following command

mvn verify

Code Quality

You can test code quality locally via sonarqube by typing the following command

mvn -Psonar compile initialize sonar:sonar

Detekt

Detekt a static code analysis tool for the Kotlin programming language

You can run detekt by typing the following command

mvn antrun:run@detekt

Rsocket

rsc --stream --route=graphql --dataMimeType="application/graphql+json" --data='{"query":"subscription { postAdded { id, title, content } }" }' --debug tcp://localhost:8079 --authBearer ${TOKEN} 
rsc --request --route=graphql --dataMimeType="application/graphql+json" --data='{"query":"{ post(id: \"632c8028feb9e053546a88f2\") { id, title } }" }' --debug tcp://localhost:8079  --authBearer ${TOKEN} 

GitHub

View Github