Learn

In web applications, the front-end and the back-end communicate via an HTTP request/response cycle. For a refresher on how client and server communicate over HTTP, take a look at the Setting up a Server with HTTP lesson. Here, we’ll focus on the information that is sent back and forth between client and server.

An HTTP request from the client to the server can be broken down into:

  • A start line that includes an HTTP method, the path for the requested resource, and the HTTP version number.
  • Headers that provide the server with additional information about the sender and the request.
  • A body, if needed. Generally, POST and PUT requests will include a body to send data.

Once the server has received the request made by the front-end, it builds a response to send back to the client. An HTTP response can also be broken down into at least two parts:

  • A status line that indicates whether or not the request was completed successfully.
  • A series of headers to give more context about the response.

Often a response from the server will contain a body, which includes data requested from the client. Generally, the server will send back the following types of data:

  • HTML documents
  • Static assets, like stylesheets, JavaScript files, and images
  • Formatted data

Instructions

Here are some questions to test your understanding of key concepts. Try answering the question on your own first. Then click on the “Check Answer” button to check your answer.

How do the front-end and the back-end of a website communicate with each other over HTTP?

Check Answer
The front-end and back-end of a web app communicate via an HTTP request/response cycle.

What are some examples of data that the back-end sends as a response to the front-end?

Check Answer
The back-end typically sends HTML documents, formatted data, and assets like stylesheets, JavaScript files, and images in its response to browser requests.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?