All Projects → rajat23 → graphql-spring-boot-mongo

rajat23 / graphql-spring-boot-mongo

Licence: other
Attempt to use GraphQL java library to build GraphQL server using spring boot

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to graphql-spring-boot-mongo

graphql-docker-api
A GraphQL Server for the Docker API
Stars: ✭ 57 (+375%)
Mutual labels:  graphql-server
graphql-server
(out of date) A command to add a GraphQL server to your Svelte project
Stars: ✭ 31 (+158.33%)
Mutual labels:  graphql-server
Workshop-GraphQL
A GraphQL Server made for the workshop
Stars: ✭ 22 (+83.33%)
Mutual labels:  graphql-server
zero-to-graphql-using-elixir
The purpose of this example is to provide details as to how one would go about using GraphQL with the Elixir Language.
Stars: ✭ 20 (+66.67%)
Mutual labels:  graphql-server
kanji
A strongly typed GraphQL API framework
Stars: ✭ 12 (+0%)
Mutual labels:  graphql-server
graphql-express-nodejs
A Simple GraphQL Server implementation using Express and Node. See post here: https://t.co/Cm6GitZaBL
Stars: ✭ 24 (+100%)
Mutual labels:  graphql-server
bunjil
A GraphQL bastion server with schema merging, authentication and authorization with Policy Based Access Control
Stars: ✭ 25 (+108.33%)
Mutual labels:  graphql-server
graphql-remote loader
Performant remote GraphQL queries from within the resolvers of a Ruby GraphQL API.
Stars: ✭ 52 (+333.33%)
Mutual labels:  graphql-server
graphql-ufc-api
GraphQL server for UFC's public API
Stars: ✭ 26 (+116.67%)
Mutual labels:  graphql-server
apollo-graphql-full-stack
Full-stack Apollo GraphQL app using React and Node JS
Stars: ✭ 31 (+158.33%)
Mutual labels:  graphql-server
graphql-directive-rest
GraphQL directive for easy integration with REST API
Stars: ✭ 39 (+225%)
Mutual labels:  graphql-server
graphql-server-typescript
GraphQL + MongoDB express server with JWT authorization (in Typescript!)
Stars: ✭ 48 (+300%)
Mutual labels:  graphql-server
character-overlay
Web App for adding an OBS overlay with character information such as name, picture, and health for your favorite role-playing game.
Stars: ✭ 17 (+41.67%)
Mutual labels:  graphql-server
corejam
A scaffolding for building progressive GraphQL powered jamstack applications.
Stars: ✭ 24 (+100%)
Mutual labels:  graphql-server
graphql-rest-api-demo
A demo of what an equivalent REST API and GraphQL API look like.
Stars: ✭ 51 (+325%)
Mutual labels:  graphql-server
graphene-sqlalchemy-filter
Filters for Graphene SQLAlchemy integration
Stars: ✭ 117 (+875%)
Mutual labels:  graphql-server
finch-graphql
Local GraphQL API in the background process of a web extension.
Stars: ✭ 48 (+300%)
Mutual labels:  graphql-server
protoc-gen-twirpql
Generate A GraphQL Layer from A Twirp Server: https://twirpql.dev
Stars: ✭ 49 (+308.33%)
Mutual labels:  graphql-server
student-api-graphql
A GraphQL Wrapper for Ellucian's Banner Student REST API
Stars: ✭ 19 (+58.33%)
Mutual labels:  graphql-server
showcase
A Full Stack Journey with Micro Services and Micro Front Ends. Using dapr, kubernetes, react module federation and web assembly,
Stars: ✭ 45 (+275%)
Mutual labels:  graphql-server

GraphQL-spring-boot

Attempt to use GraphQL java library to build GraphQL server using spring boot.MongoDB is used as a storage.

Schema for GraphQL (SDL)

  • resources/schema.graphqls contains GraphQL schema defination for query,resolver and types

Application Initialization

  • Unit tests runs using gradle clean test
  • Make sure you have mongo installed on your machine.App will connect on port 27017 by default.
  • Start mongoDB using mongo command.
  • Embedded tomcat of spring boot starts using gradle bootRun

Query

  • Fetch all blogs : http://localhost:8080/graphql POST Endpoint. Request body format : { "query": "{allBlogs{title}}" }

  • It sounds little stupid here to fetch all blogs using POST http method but it is used so we can pass query as a part of request body. We can change is to GET and pass actual query as query param.

  • Resonse that you will get is : { "allBlogs": [ { "title": "REST in peace.GraphQL live long" }, { "title": "Kotlin for Android" } ] }

  • Lets add one more parameter to request body i.e content { "query": "{allBlogs{title content}}" }

  • Response : { "allBlogs": [ { "title": "REST in peace.GraphQL live long", "content": "GraphQL dominating now days" }, { "title": "Kotlin for Android", "content": "how useful is kotlin for android dev" } ] }

Mutation aka POST

  • GraphQL provides feature of Mutation which let us create new enitity.

  • Create Blog: http:/localhost:8080/graphql. Request Body: { "query": "mutation createBlog {createBlog(title:\"hello\",content:\"world\") {title content}}" }

  • Response: { "createBlog": { "title": "hello", "content": "world" } }

  • If you now again Query all blogs response would be { "allBlogs": [ { "title": "REST in peace.GraphQL live long", "content": "GraphQL dominating now days" }, { "title": "Kotlin for Android", "content": "how useful is kotlin for android dev" }, { "title": "hello", "content": "world" } ] }

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].