This is the backend for the Item Viewer demo application. It is a Lambda function that takes requests from the frontend, calls the Real Item API using an API key, and returns the results to the frontend.
You can check out the frontend part here:
https://github.com/realitems/item-viewer-frontend
This project was built using AWS SAM. If you don't use SAM, or you just want to see the code, you can find it in /lambdas/proxy/index.js
.
If using SAM, set your S3 bucket in samconfig.toml
and run the following commands to deploy:
sam build
sam deploy
To debug using VSCode, you can use the launch.json
file in the .vscode
folder. You need to have the AWS Toolkit extension installed for VSCode. In the launch.json
file, make sure to set the API_KEY
and CONTRACT_ID
environment variables.
In launch.json
, you can change the payload.path
value to test different functions.
Warning: Do not commit your API key.
If you are deploying to AWS:
- It is recommended to use Secrets Manager to store your API key.
- Make sure to implement some type of authentication for the Lambda function URL.