What is a Client?
A client is a computer or a program that, as part of its operation, relies on sending a request to another program or a computer hardware or software that accesses a service made available by a server (which may or may not be located on another computer).
The other side of this relationship is the server, which hosts information and returns it to the client when requested. The client asks for information and consumes it, while the server provides a service.
What is a REST client?
In RESTful APIs, an API sits between the client and the server, and requires authentication to pass through. A client makes a request to an API at an endpoint which it has access to. The API validates the request and passes the request to the destination server or program. The server sends a response back, first through the API, which then transfers it back to the client.
Why put it all in one place?
Sometimes, clients and servers are in the same place, as in the case of a home PC retrieving a document from its own hard drive. But why do we separate clients and servers at, for example, a business?
- Centralized Information Storage - Everyone has the same information, and it's up-to-date. This information might require higher security.
- Collaboration - Having information on one server ideally allows everyone to access information, but it doesn't always work that way. We've seen recently the rise of internal APIs as a way to prevent information silos forming between teams in large companies.
- Resource management - Management between the front end (client) and backend (server) is an engineering balancing act. Servers are significantly more powerful than client hardware.
- Security - The people who need access can get access, and those who don't are kept out.
The client asks, the server serves, and that's how it's been through the rise of the internet, the cloud, and microservices. Even as applications are spread across clusters and development becomes cloud-native, we still have the client sending requests, and the server issuing responses.