Setting and enable CORS
In this section, we will add binary file support settings and enable CORS for the APIs
- Select Settings on the left menu.
- Click Add Binary Media Type
- Enter multipart/form-data
- After the setting is done, back to Resource on the left menu.
- Select /books resource
- Click Actions
- Select Enable CORS
- Click Enable CORS and replace existing CORS headers
- Click Yes, replace existing values
- Enable CORS for successful GET and POST methods
- Select books/{id} resource
- Click Actions
- Select Enable CORS
- Click Enable CORS and replace existing CORS headers
- Click Yes, replace existing values
- Enable CORS for successful DELETE method
- To front-end can use APIs, we need deploy APIs.
- Select / resource
- Click Actions
- Select Deploy API
- Select New stage
- Enter stage name, such as: staging
- Take note URL to call API
- URL of list and write API: