The Grocery Item Store API is a RESTful API for managing grocery items with expiration dates and other related information.
- Clone the repository:
git clone https://github.com/diorchen/rest-server
- Install the required dependencies:
go mod tidy
- Build the project:
go build
- Run the compiled executable:
./rest-server
- URL:
/food/
- Method:
POST
- Request Body:
{
"name": "Apple",
"description": "Fresh and juicy apple",
"ingredients": ["Apple"],
"expiration": "2023-07-31T00:00:00Z",
"nutrition": {
"calories": 52,
"protein": 0.3,
"carbohydrates": 14,
"fat": 0.2,
"fiber": 2.4
}
}
- URL:
/food/
- Method:
GET
- URL:
/food/{id}
- Method:
GET
- URL:
/food/{id}
- Method:
DELETE
- URL:
/ing/{ingredient}
- Method:
GET
- URL:
/exp/{year}/{month}/{day}
- Method:
GET