Coder Social home page Coder Social logo

ashishlahoti / spingboot-graphql Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 5.0 95 KB

Spring Boot Microservice example as GraphQL Server

Java 100.00%
spring-boot graphql-java graphql-java-kickstart netflix-dgs graphql-server graphql-api graphql-playground

spingboot-graphql's Introduction

Spring Boot GraphQL

This provides examples to use GraphQL in a spring-boot based project.

GraphQL

GraphQL is a query language to retrieve data from a server. It is an alternative to REST, SOAP or gRPC in some way. It gives more power and flexibility to your API consumer to query only required data.

GraphQL Java

GraphQL-Java is the Java (server) implementation for GraphQL. This provides a low level libraries to define GraphQL schema and how the actual data for a query is fetched. You have to write a lot of boilerplate code if you use graphql-java.

Fortunately, We have two libraries available which provides a wrapper on top of graphql-java and saves use from writing boilerplate code. They are:-

  1. GraphQL Java Kickstart
  2. Netflix DGS

GraphQL Java Kickstart

GraphQL-Java-Kiskstart provides a wrapper on top of graphql-java and has following features:-

  1. Provide comprehensive Spring boot configuration to customize GraphQL Java Server
  2. Auto-detect schema files in src/main/resources/*.*/*.graphqls directory. This is where you write GraphQL schema, queries and mutation.
  3. Concepts of Resolver. Implement GraphQLQueryResolver, GraphQLMutationResolver and GraphQLResolver<T> to specify how to fetch data for the queries, mutation and nested data respectively.
  4. Easy integration with build tools such as GraphiQL, PlayGround and Voyager by adding runtime dependency. Provide comprehensive Spring Boot Configurations to customize these tools.
  5. Easy to write integration test using GraphQLTestTemplate provided by test dependency.
  6. Excellent tutorial series by Philip Starritt which gives you quick start.

Netflix DGS

Netflix-DGS is developed by Netflix on top of graphql-java and recently made it public to use. It has following features:-

  1. Do not provide Spring boot based configurations
  2. Auto-detect schema files in src/main/resources/schema/*.*/*.graphqls directory. This is where you write GraphQL schema, queries and mutation.
  3. Concepts of DataFetcher. Provide annotations @DgsComponent at class level and @DgsQuery, @DgsMutation, @DgsData at method level to specify how to fetch data for the queries, mutation and nested data respectively.
  4. Provide integration with GraphiQL
  5. Provide good support to write unit and integration test cases using DgsQueryExecutor
  6. Follow example to quick start

spingboot-graphql's People

Contributors

ashishlahoti avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.