Posts

Showing posts with the label GraphQL

GraphQL - topics

Image
  Introduction Project Creation Test with GraphiQL Test with postman

01. GraphQL - Introduction

Image
  Guiding Tutorial -   01.Channel : https://www.youtube.com/@DanVega   Video: https://www.youtube.com/watch?v=TVk2fMEezO4&list=RDCMUCc98QQw1D-y38wg6mO3w4MQ&index=3&ab_channel=DanVega   https://www.howtographql.com/basics/0-introduction/   GraphQL යනු , GraphQL යනු REST,SOAP වැනි API ලියන තවත් එක් technique එකක් වන අතර මෙහි ඇති විශේෂත්වය වනුයේ single end point එකක් හරහා multiple consumers ලට dynamically ව ඔහුන්ට අවශ්‍ය data පමණක් access කර ගන්න පුළුවන් විදිහට මෙම API ලියන එකයි. Rest හෝ SOAP වලිදී end point ගොඩක් ලියනවා වෙනුවට GraphQL වලදී single end point එකකින් මේකේ වැඩේ කර ගත හැක.   Ex: There is an API end point which prove a Student Object based on given ID. Student [ID, StudentFirstName, StudentLastName, Age]   Consumer 01 : I want full student object. Consumer 02 : I want only student first name and age. Consumer 03 : I want only student last name.   Rest or SOAP වලදී නම් එක්කෝ end po...

02. GraphQL - Project Creation

Image
Created project GitHub Link - https://github.com/LahiruPriyankara/graphQL   Create spring boot project by adding bellow dependencies. application.property server.port =2020 spring.datasource.driver-class-name =com.mysql.cj.jdbc.Driver spring.datasource.url =jdbc:mysql://localhost:3306/graphql? createDatabaseIfNotExist =true spring.datasource.username =root spring.datasource.password =root #spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto =create spring.jpa.properties.hibernate.dialect =org.hibernate.dialect.MySQL8Dialect spring.graphql.graphiql.enabled =true spring.graphql.schema.printer.enabled =true #spring.graphql.cors.allowed-origins=* schema.graphqls type Student {     id: ID!     firstName: String     lastName: String     age: Int     gender: Gender     studentClass: StudentClass }   enum Gender{     MALE,     FEMALE }   type StudentClass { ...

03. GraphQL - Test with GraphiQL

Image
  Test Application   Run the application You can test GraphQL application using UI or Postman( or similar IDE). 01. Using UI   Hit on browser. -  http://localhost:2020/graphiql?path=/graphql 01. Getting all Student (Without pagination) query{   allStudent{     id     firstName     lastName     age     studentClass{       id       grade       teacherName     }   } } 02. Getting a specific Student query{   findStudent(id:4){     id     firstName     lastName     age     studentClass{       id       grade       teacherName    ...

04. GraphQL - Test with postman

Image
  Postman Collection GitHub Url - https://github.com/LahiruPriyankara/graphQL Test using Postman