Test APIs with front-end

After testing that the APIs work properly with Postman, we will test the APIs that are called with the front-end built from part 2.

  1. Open config.js in fcj-serverless-frontend folder that downloaded from part 2
  • Change value of APP_API_URL with your URL:

CreateRestAPI

UpdateURL

  1. Open App.js in fcj-serverless-frontend/src/, change value of isAdmin with true
  2. Run the command lines under here:
yarn build
aws s3 cp build s3://fcj-book-store --recursive
  1. Paste the endpoint of S3 static web into your browser. The app already shows the book information, but still no pictures because we haven’t uploaded the pictures yet.

WebApp

So the listing API is working properly

  1. Test writing API
  • Click Management tab
  • Click Update

WebApp

  • Edit whatever you want except id
  • Click Choose image
  • Upload the below image to the bucket:
  • Click Update

WebApp

  • Click OK

WebApp

  • Image and information updated

WebApp

  • Click on the Create new book tab to write new data to the database
  • Enter id with 5
  • Enter name: Amazon Web Services in Action
  • Enter the author: Andreas Wittig
  • Enter category: IT
  • Enter price: 59.99
  • Enter a description: Amazon Web Services in Action, Second Edition is a comprehensive introduction to computing, storing, and networking in the AWS cloud. You'll find clear, relevant coverage of all the essential AWS services you to know, emphasizing best practices for security, high availability, and scalability.
  • aws.jpg (24 ko)
    • Press the Choose File button to upload the image
    • Press the Create button

    WebApp

    • Click OK

    WebApp

    • Display newly created information

    WebApp

    1. Test the deleting API
    • Click Management tab
    • Click Update

    WebApp

    • Click Delete

    WebApp

    • Click OK to confirm delete

    WebApp

    • Click OK

    WebApp

    • View results after deleting: no appearing book information

    WebApp

    We have finished building a simple SAM-based web application following the serverless model.