This is API processes receipts and calculates points based on specific rules. The service provides two main endpoints: one for processing receipts and another for retrieving points for a processed receipt.
- Path:
/receipts/process - Method:
POST - Payload: Receipt JSON Example
- Response: JSON containing an id for the receipt
This endpoint takes a JSON receipt and returns a JSON object with a generated ID for the receipt.
Example Response:
{
"id": "7fb1377b-b223-49d9-a31a-5a02701dd310"
}- Path:
/receipts/{id}/points - Method:
GET - Response: A JSON object containing the number of points awarded
This endpoint retrieves the points awarded for a specific receipt ID.
Example Response:
{
"points": 32
}go mod tidy
go run cmd/server/main.goor
docker build -t receipt-processor .
docker run -p 8080:8080 receipt-processor- The application is built using go.
- Data is stored in sqlite.
go test ./...