This project is a RESTful API built using Fastly Compute@Edge and Fauna. It manages a simple inventory with basic CRUD (Create, Read, Update, Delete) operations. This project was generated from the fastly-compute-at-edge-starter-kit.
- A Fauna account
- Fastly account
- Node 18 installed
Follow these steps to get the Inventory Management REST API up and running:
- Clone this repository
- Install dependencies:
npm install
- In your
fastly.toml
file in the root directory add the following environment variables: -FAUNA_ACCESS_KEY
: Your Fauna secret key - Run the project locally:
fastly compute serve
You can use tools like Postman or CURL to test the API:
curl -X POST http://127.0.0.1:7676/inventory -H "Content-Type: application/json" -d '{"item": "Apple", "quantity": 10, "price": 2}'
curl -X GET "http://127.0.0.1:7676/inventory"
curl -X GET "http://127.0.0.1:7676/inventory/<some-id>"
curl -X PUT "http://127.0.0.1:7676/inventory/<ID>" -H "Content-Type: application/json" -d '{"item": "Updated Apple", "quantity": 20, "price": 3}'
curl -X DELETE "http://127.0.0.1:7676/inventory/<ID>"
This project was created from the fastly-compute-at-edge-starter-kit. To deploy, simply follow the instructions found in the README.