Search
 
SCRIPT & CODE EXAMPLE
 

SQL

graphql

Graphql: A query language
------------------------------------
So you know about REST APIs, they can have endpoints, you can
post data or get data from those endpoints

-- /users/:id/
-- /foo/baz/bar

But when things grow, more and more endpoints are required, and
a lot of unnecessary data is fetched, like when we want to get a an author's
books from a book id, you will send a request to /books/:id to get your book 
(2 roundtrips from client/server), with more
unnecessary data that you don't need such as the release date, sales ....
Then you get the author id, make ANOTHER request to /authors/getprofile/:id to
get the author with more data you don't wanna fetch (4 roundtrips total),
and then you wanna get all their books, ANOTHER request to 
/books/fromauthor/:id, it's now 6 roundtrips! But now with graphql
we have one, single, endpoint /graphql where we can send a query,

query {
  author {
    books
  }
}

2 roundtrips, one single endpoint, one request, boom!
--------------------------------------------------
GraphQL is developed by Facebook and the community, released in 2015,
has many implementations in many languages

-- github.com/graphql
-- graphql.org
-- npm i graphql
Comment

graphql

{
  project(name: "GraphQL") {
    tagline
  }
}
Comment

PREVIOUS NEXT
Code Example
Sql :: query to find third highest salary 
Sql :: split string and get first and last element in sql server 
Sql :: case statement in select query in sql 
Sql :: set column width in sqlplus 
Sql :: SQL order by string split length 
Sql :: get stored procedure text sql server 
Sql :: tsql edit table column 
Sql :: sql to c# model 
Sql :: sqlalchemy get ids 
Sql :: SQL Server OPENJSON FROM table column 
Sql :: how to update sql server version 
Sql :: drop procedure if exists sql server 
Sql :: creating sql table 
Sql :: partition-by 
Sql :: mysql extract day from date leading zero 
Sql :: insert or update sql query 
Sql :: not keyword in sql 
Sql :: array aggre distinct postgres 
Sql :: how to select from mssql 
Sql :: select where mysql 
Sql :: trunc sysdate in oracle 
Sql :: how to get second highest salary in each department in sql 
Sql :: uuid sqlalcomany 
Sql :: SQL:RANK function to delete duplicate rows 
Sql :: mysql inner join 
Sql :: row number sql 
Sql :: oracle sql trigger select into 
Sql :: Pl/Sql table based record 
Sql :: above average salary in sql 
Sql :: php select data from mysql database without column name 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =