-
Book Overview & Buying
-
Table Of Contents
A Developer's Guide to Building Resilient Cloud Applications with Azure
By :
Serverless architecture is a software design pattern where applications are hosted by a third-party service, allowing developers to build and run services without having to manage the underlying infrastructure.
Applications are divided into separate functions that can be called and scaled individually.
Developers implement and deploy application-only code and can run applications, databases, and storage systems hosted in servers provisioned by cloud providers.
We will understand the role of APIs inside an application and the ecosystem. To start modernizing legacy applications without any modification, we can use APIs to interact with existing code. These APIs will run in the cloud, but if we need to add more features to the application to modernize it, we will encapsulate the data and the functions in services via an API. This encapsulation phase is a technique that consists of reusing legacy software components. The goal is to keep the code in its environment and connect it to the new presentations via encapsulation to access the different layers through an API. APIs permit you to define common protocols (rules) to expose data from an application with the possibility of decoupling the presentation layer.
Technically, the encapsulation works with wrapper technology, providing a new interface for a legacy component. This component will be easily accessible from the rest of the software components.
These minimal modifications reduce the risk of destabilizing the application. Even if encapsulation is a fast, effective, and less expensive solution, it will not solve the present problems related to the difficulties of maintenance or upgrading.
Because we are talking about the role of APIs in digital transformation and their life cycle, we need to define them.
APIs form a bridge between different applications to ensure communication and the exchange of information between them. They can even define the behavior of these applications.
APIs are considered connectors because they provide the ability for disparate applications to exchange information.
The information exchanged is generally data; for example, if we make a request in a mobile application, the data will be sent to a server that performs the reading and then sends back a response in a format readable in JSON.
Sometimes, microservices are compared with APIs. We often talk about the relationship between APIs and microservices, but there is also a difference between them. Microservices are a style of architecture that divides an application into a set of services; each service presents a very particular domain, for example, an authentication service or another service for the management of the products. On the other hand, an API is a framework (a structure that you can build software on) used by developers to provide interaction with a web application. Alternatively, microservices can use an API to provide communication between services. But how does an API work?
Applications that send requests are called clients, and applications that send responses are called servers. Using bees as an example, the hive is the client, the flower is the server, and the bee is the communication path (REST API requests).
The API manager – usually the enterprise architect or API product manager – manages the API life cycle.
The API life cycle consists of the following three main phases:
After understanding the API life cycle and the different phases, we will next look at the important role of an API in terms of communication between applications.
A set of rules ensures the communication of APIs by defining how applications or machines can communicate, so the API is an intermediate bridge between two applications wanting to communicate with each other.
A web API is an API that can be accessed via the HTTP protocol. There are many API protocols/specifications, as follows:
The most popular type of API is RESTful because it has several advantages in terms of flexibility when creating an API that meets the client’s needs and dependencies because the data is not bound to methods or resources. A RESTful API supports different data formats, such as application/json, application/xml, application/x-wbe+xml, multipart/form-data, and application/x-www-form-urlencoded.
RESTful APIs take advantage of existing protocols – for example, web APIs take advantage of the HTTP protocol.
So far, in this chapter, we have talked about encapsulation to access the different layers through an API as a technique used for legacy system modernization. We have presented the API life cycle and API roles, which encompasses several roles to ensure communication, and we have identified the API types, such as RESTful APIs, which are the most popular. In the next section, we will present the event-driven architecture used to improve agility in complex applications.