Skip to content

codeprismtechnologies/starter-graphql-springboot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starter-GraphQL-SpringBoot

GraphQL is a modern replacement for the well known REST API server. This is a pure GraphQL server application - an example API server.

Introduction

This is a sample graphql spring boot project. This project has implemented all the crud operations in a simple way.

Technologies:

  1. Java 17
  2. Spring Boot 2.7.4
  3. Gradle 7.5.1
  4. GraphQL Java

Features:

  1. Input data validation.
  2. Custom Exception

Clone this project using:

git clone https://github.com/codeprismtechnologies/starter-graphql-springboot.git

Pre-requisites:

  • Make sure you are using Java version 11 or 17
  • Install and start MySQL server
  • Make sure using gradle version using 7+

Run

  • After cloning project. Refresh gradle once.
  • Run project as springboot application
  • To start executing queries using graphiql/playground. Copy any url(playground recommended) from below and open in any browser Safari/Chrome/Mozilla..etc
http://localhost:9090/playground
http://localhost:9090/graphiql

Query Examples

To create new user:

mutation{
  signUp(user:{
    displayName:"your nyce name"
    firebaseId:"123HFN",
    email:"your email",
    phoneNumber:"1234567890",
    dateOfBirth:"2022-01-10",
    gender:MALE,
    profileUrl:"your profile url",
    loginStatus:LOGGEDIN,
    role:USER,
    provider:FACEBOOK,
    language:"your language code",
    heartPoints:2.0,
    state:"your state name",
    country:"your country code",
    city:"your city name",
    address:"your full address",
    passportId:"your passport id",
    taxId:"your tax Id",
    postalId:"your postal id",
    timeZone:"Etc/UTC",
    cityZenShipCountry:"INDIA",
    lastLogin:"2020-04-03 12:10:00"
  }){
    id
    displayName
    .......
  }
}

To update user details:

mutation{
  updateSignUp(user:{
    userId:1
    displayName:"your updated nyce name"
    firebaseId:"123HFN",
    email:"your email",
    phoneNumber:"1234567890",
    dateOfBirth:"2022-01-10",
    gender:MALE,
    profileUrl:"your profile url",
    loginStatus:LOGGEDIN,
    role:USER,
    provider:FACEBOOK,
    language:"your language code",
    heartPoints:2.0,
    state:"your state name",
    country:"your country code",
    city:"your city name",
    address:"your full address",
    passportId:"your passport id",
    taxId:"your tax Id",
    postalId:"your postal id",
    timeZone:"Etc/UTC",
    cityZenShipCountry:"INDIA",
    lastLogin:"2020-04-03 12:10:00"
  }){
    id
    displayName
    ......
  }
}

To Get user details:

query{
  getUser(userId:1){
    id
    displayName
    profileUrl
    phoneNumber
    .....
  }
}

To GetAll user details:

# you can put count acording to your choice
query{
  getAllUser(count:2){
    id
     displayName
    profileUrl
    phoneNumber
  }
}

To Delete user:

mutation{
  deleteUser(userId:2)
}

Screenshots:

Playground:

Screenshot 2022-10-11 at 11 53 56 AM

Screenshot 2022-10-11 at 11 53 26 AM

Screenshot 2022-10-11 at 11 51 31 AM

Graphiql:

Screenshot 2022-10-10 at 11 44 24 PM

Screenshot 2022-10-10 at 11 46 20 PM

Screenshot 2022-10-10 at 11 46 36 PM

codeprism.in

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages