So far, we've only talked about classic web applications: hypertext pages displayed in a browser. A typical web application only gives the browser pages. We refer to this sort of application as a website. In this lesson, we'll learn how to arrange them and what interfaces to use.
How applications work
Modern complex web applications generally behave differently from websites:
- The user enters the address of the application in the browser
- In response, the server returns an HTML page once
- Next, JavaScript gets used. The page is responsible for displaying data not embedded in the page markup. The data get loaded from the server by separate requests from the page to API
An API (Application Programming Interface) is a protocol for communication between your application and other programs. The API isn't responsible for communication between the application and the user. Instead, the user usually uses a separate client program that accesses the server as needed. API differs from the browser, which asks for a web page when the user enters a URL or clicks a link.
Moreover, one client application can use several different APIs. And not all of these APIs are even provided by the server that gave the original page! So, one site can simultaneously show three embedded elements: a tweet, a route from Google Maps, and a YouTube video. We request this content from the relevant services through the API.
Another example of an API is logging into a site via a social network. In this case, the interaction between the client (browser) and the servers can be complex.
The modern web is unimaginable without lots of different APIs. They allow companies to do one thing well, like maps, photo storage, or authentication. In this case, any developer can use these ready-made developments in their applications. And in the end, everyone wins, be they users, application developers, or API owners who earn money from their content.
Are there any more questions? Ask them in the Discussion section.
The Hexlet support team or other students will answer you.
For full access to the course you need a professional subscription.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.