Learning Objectives

  • Explain how to set up and run an Express application
  • Build a simple Express API and send a HTTP request to an available endpoint using a HTTP client
  • Explain that JSON is a widely-used language-agnostic format for encoding data as attribute value pairs
  • Diagram the request and response cycle for an Express API.
  • Use console.log() and read the result in the server logs

Exercise

Implement the API for the Address Book Challenge using the client app.

Use the API Spec as your source of requirements for each endpoint you need to build.

Before you begin, the API is going to use global variables to hold data - which will persist while the application is running, but won't persist in between application restarts.

Set up

  1. Fork and clone this repository

  2. Fork and clone the client app repository

  3. Run the client app from your terminal.

  4. Create an express application following the steps above.

  5. Implement the API for the client app, starting with the contacts endpoint, following this workflow for each endpoint:

    1. Diagram the endpoint lifecycle in a sequence diagram, using the image below these steps as a starting point
    2. Implement the endpoint
    3. Test the endpoint using any method you like; the client app with console logs, Insomnia, curl etc.

Extension

Implement GET, POST, PUT and DELETE endpoints for meetings following the same workflow as above