Setting and enable CORS

In this section, we will add binary file support settings and enable CORS for the APIs

  1. Select API Settings on the left menu.

    • Click Manage media types CreateRestAPI
  2. Click Add binary media type

    • Enter multipart/form-data
    • Click Save Changes CreateRestAPI
  3. After the setting is done, back to Resource on the left menu.

    • Select /books resource
    • Select Enable CORS CreateRestAPI
  4. For Enable CORS

    • Choose GET and POST method
    • Click Save CreateRestAPI
  5. Select /{id} resource

    • Select Enable CORS CreateRestAPI
  6. For Enable CORS

    • Choose DELETE method
    • Click Save CreateRestAPI
  7. To front-end can use APIs, we need deploy APIs.

    • Select / resource
    • Click Deploy API CreateRestAPI
  8. Select New stage CreateRestAPI

  9. Enter stage name, such as: staging

    • Click Deploy CreateRestAPI
  10. Take note URL to call API CreateRestAPI

    • URL of list and write API: CreateRestAPI

    • URL of delete API: CreateRestAPI