Few weeks ago (12.03.19) we celebrated 30th birthday of WWW
Thank you Google for reminding me
URL
HTTP
REST vs GraphQL
Routing in the past
Routing nowadays
For instance:
The task that is traditionally solved using the HTTP protocol is data exchange between a user application accessing web resources (usually a web browser) and a web server.
There are lots of them but they are less useable...
The different operations that can be done with HTTP:
HTTP defines several status codes, each pertaining to a specific scenario. 2xx: the request completed successfully and without errors. 3xx: implies redirection. 4xx: are used when there is an error in the request made. 5xx: Lastly, a 5xx response is used when there is an error on the server side.
Headers are an essential part of HTTP communication. They serve to provide additional information for handling requests and responses.
short for REpresentational State Transfer, is an architectural style that aims to leverage all the same constructs that have allowed to the Web to grow over the last couple of decades. It uses these as guiding principles for designing web services.
This is a syntax that describes how to request data and is basically used by the client to download data from the server.
The key to the REST concept is the resource.
Each resource is identified by its URL, and in order to obtain the resource, it is necessary to send a GET request to this URL.
Most likely, the answer will come in the JSON format, since this particular format is now used in most APIs.
GraphQL has three main features:
Allows the customer to specify exactly what data he needs.
Easily aggregates data from multiple sources.
Uses a type system to describe the data
GET /books/1
{
"title": "Types & Grammar",
"author": {
"firstName": "Kyle",
"lastName": "Simpson"
}
// ... other field
}
GET
/graphql?query={
book(id: "1") {
title, author { firstName }
}
}
{
"title": "Types & Grammar",
"author": {
"firstName": "Kyle",
}
}
window.onpopstate = (event) => {
alert("location: " + document.location + ", state: "
+ JSON.stringify(event.state));
};
history.pushState({page: 1}, "title 1", "?page=1");
history.pushState({page: 2}, "title 2", "?page=2");
history.replaceState({page: 3}, "title 3", "?page=3");
history.back();
// "location: http://example.com/example.html?page=1, state: {"page":1}"
history.back();
// "location: http://example.com/example.html, state: null
history.go(2);
// "location: http://example.com/example.html?page=3, state: {"page":3}