LazyStack

Test Local WebApi

In this step we will use a browser page to make calls against the local WebApi (PetStore) project.

5.1 Test WebApi using Browser

  1. Set the startup project to PetStore and select PetStore instead of IIS Express.
  2. Start Debugging the PetStore project. A browser tab opens showing the Swagger PetStoreAPI.
    • You may see a Security Warning dialog regarding the installation of a certificate for "localhost". Select "yes" if this dialog appears.
  3. Execute the "/pet/seedPets" call. (Note: You need to click on "Try it Out".) Two pets are added to the DynamoDB table.
  4. Execute /pet/findByStatus with petStatus = 0. Two pet records are returned in the Response body.
  5. Stop Debugging.
Step Summary

In this step we launched the local WebApi (PetStore) project and then made calls against it using the local server's Swagger page. Our call to "/pet/seedPets" executed the PetStoreRepo project's PetRepo.SeedPetsAsync() method. The local WebApi (PetStore) project used your local AWS credentials to access the PetStoreDev stack DynamoDB resource.

In addition to making calls using the browser, later lesson steps will demonstrate making calls against the WebApi (PetStore) project from client apps. This allows you to debug both the client code and controller code at the same time.