The supermarket-api is a Golang application that responds to HTTP requests for updating produce information in a backend database. The application is meant to be deployed in docker.
To quickly run locally, you can use:
docker run -d -p 6620:6620 dirtysoc/supermarket-api
Produce:
{
"name": "produce name",
"produceCode": "16 character alphanumeric identifier with dashes every 4 characters",
"unitPrice": "The unit price of the produce in USD with 2 digit accuracy",
}
-
GET /produce
returns all produce as JSON -
GET /produce/{id}
returns details of a specific produce as JSON -
POST /produce
add a produce item to the database* -
POST /produce
add multiple produce items to the database -
DELETE /produce/{id}
removes produce from the database by produceCode
* Note that all JSON body data must be a JSON array. For example, adding a single new produce item requires that the JSON body of the POST request be a JSON array with a single object in it.
Builds are automated and all pushes to the master branch are tested, built and uploaded to Docker Hub.
- Install Golang
- Clone repo
cd
into repo- Edit and run
go test
or build withgo build
and test.
User Stories | Narrative |
---|---|
Adding new produce | As an employee, I want to add produce, so that I can add items to the database |
Deleting a produce item | As an employee, I want to delete produce, so I can remove produce from the database |
Fetch the produce inventory | As an employee, I want to look up produce, so that I understand what produce is available |