- docker pull redis
- npm install
- Update .env.local variable
- npm run dev
This API provides endpoints to manage items and purchase orders. It supports basic operations such as retrieving items, updating item quantity, and managing user purchases.
Get the list of all items with specified price in Ethereum.
Request:
GET /items
Response:
[
{
"item": "exampleItem",
"description": "An example item",
"quantity": 10,
"price": 656.8,
"currency": "ETH"
},
// ... other items
]
Admin-only endpoint to enter a new item.
Request:
POST /items
Body:
{
"item": "newItem",
"description": "A new item",
"quantity": 20,
}
Response:
{
"message": "Item created successfully"
}
Admin-only endpoint to update the quantity of a specific item.
Request:
PUT /items/[slug]
Body:
{
"quantity": 25
}
Response:
{
"message": "Item quantity updated successfully"
}
Get the list of all purchases for a user.
Request:
GET /purchase
Response:
[
{
"userId": "xxxx-xx-xxx"
"itemName": "Laptop"
"datePurchased": "DATE ISO format"
"quantity": 6
"amountPaid": 12455
},
// ... other purchases
]
Create a purchase order for a user.
Request:
POST /purchase
Body:
{
"item": "exampleItem",
"quantity": 2
}
Response:
{
"message": "Purchase order created successfully"
}
This API is designed to be user-friendly and secure, with certain endpoints restricted to admin access for better control over item management.
Feel free to use this documentation as a starting point and customize it according to your specific implementation.