01. GraphQL - Introduction

 





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 point 3 ක් දෙන්න වෙනවා.එහම් නැත්තන් දෙන full student object එකෙන් ඕනේ කරන data ටික විතරක් consumer ට filer කරලා ගන්න වෙනවා.නමුත් GraphQL වලදී එක end point එකක් හදන අතර consumer ට පුලුවන් එයාට ඕනේ කරන data ටික request කරන්න.ඉතකොට ඒ data ටික විටරක් API එකෙන් provide කරනවා.

 

As a summary.

 01.New API standard that was invented and open source by Facebook. 

02.Enable declarative data fetching.

Client ට පුලුවන් decide කරන මොන data API එකෙන් fetch කරන්න ඕනේ කියල.නමුත් rest API වලදී නම් API එකෙන් දෙන response එක එහෙම්මම client access කරලා එකෙන් අවශ්‍ය data ටික ගන්න තමයි සිදු වෙන්නේ.එහෙම නැතුව client ට බෑ API එකෙන්ම dynamically ව ඕනේ කරන data ටික විටරක් ගන්න.එනම් එකම API end point එකෙන් client ට ඒ ඒ අවස්තාවට අනුව dynamically client ට ඔනේකරන data ටිකගන්න බැ.  

 03.   GraphQL sever exposes single endpoint and responds to queries.

Multiple End Point හදලා fixed data structure එකක් provide කරනවා වෙනුවට single end point එකක් හරහා එක multiple consumers ලට ඔහුන්ට අවශ්‍ය data පමණක් access කර ගන්න පුළුවන් විදිහට provide කරන technology එකකි. 

Schema define කිරීමේදී පහත පරදී keyword use වේ.

Query - to retrieve data (Read).

Mutation - to change the data (Create, Update, Delete).

Subscription - Which allows to create a connection to read data and keep that connection for when data changes (15.00).

Comments

Popular posts from this blog

09.Data Binding.

Database - Topics

02. Spring – Creating spring project clone it with GIT step by step.