We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Requests and Responses Quiz

  • A "client" is a computer making an HTTP request
  • A "server" is a computer responding to an HTTP request
  • A computer can be a client, a server, both, or neither. "Client" and "server" are just words we use to describe what computers are doing within a communication system.
  • Clients send requests and receive responses
  • Servers receive requests and send responses

Example Code

const issueURL: string = 'https://api.boot.dev/v1/courses_rest_api/learn-http/issues'

const issues = await getData<Issue[]>(issueURL)

logIssues(issues)

async function getData<T>(url: string): Promise<T> {
  const apiKey = generateKey()
  const response = await fetch(url, {
    method: 'GET',
    mode: 'cors',
    headers: {
      'X-API-Key': apiKey,
      'Content-Type': 'application/json'
    }
  })
  return response.json()
}