Client
Last updated
Last updated
The client is a piece of computer software or hardware that consumes some service made available by a server. The server is often (but not always) on another computer system, in which case the client accesses the service by way of an HTTP request.
In this part of our course, we are working with Web applications, so it's easiest for us to start by looking at this type of client. Take a look again:
So far, we have only looked at HTML, CSS, and some JavaScript. These three are fused to make web applications. When these applications start to make requests for data, they become 'clients' making HTTP requests. The data that the client asks for comes from a 'server'. The server holds logic for accessing the database. More on this later.
If we were to have a mobile application with our project, we would introduce a second client. That client would make requests to the same server. Even though we're not building a mobile application in this portion of the course, it does help us to see that we can have multiple clients accessing the same data. Look at the diagram:
Use the diagram above to consider a common application, like Facebook. Here are the two clients to consider: 1. The Web Application 2. The Mobile Application
Take #1. If you are on a laptop, the client for Facebook can be found at www.facebook.com. When you go to that URL, you are looking at a web client, a user interface on the web for users to access data that is organized and dynamically able to change. You can make requests from there (we'll talk about this next). You can see your own personal data (more on this soon, too).
On the other hand, if you are on an iOS device and you are using the Facebook app (downloaded from the app store), you are using a whole different client. It's a whole different application, written in a different language, with different rules and a completely different user interface. It is siloed on the phone or other mobile device (iPad).
It's important to note that the mobile native app NEVER touches or accesses the web version. The two apps only cross paths in that they both are accessing the same server, API, and database.
In JavaScript, you'll hear client side development mentioned a lot. So when speaking about clients and servers in JavaScript, generally speaking your client side is where you are writing your front-end code, like your HTML/CSS and JS. It's also where you make requests to the API, and display the information you receive back from it. We've mentioned React and Angular, these are both client-side. We've also mentioned Node, that is server-side, or something you could use to create an API, process requests, grab info and then return information to the client.
Let's keep it simple for now. Just remember that a client has two major jobs: 1. Display data for the user. Render items to the DOM. 2. Make HTTP requests to the server. We'll talk about this next.