A Node.js Express API for searching grocery store offers using the Marktguru service.
Offers API is a simple REST API that allows you to search for supermarket deals and offers. It leverages the Marktguru service to retrieve offers for specified search terms, with support for filtering by retailers, location (zip code), and pagination.
- Search for grocery store offers by term
- Filter offers by specific retailers
- Pagination support (limit and offset)
- Location-based search with zip code
- Health check endpoint
- JSON request/response format
- Error handling and logging
- Node.js (v14 or higher)
- npm
- Clone the repository or download the project
- Navigate to the project directory
- Install dependencies:
npm installnpm startThe API server will start on port 3000 (or the port specified in the PORT environment variable).
Search for offers by term.
Parameters:
:search(URL parameter) - The search term for offers
Request Body (JSON):
{
"limit": "1000",
"offset": "0",
"allowedRetailers": [],
"zipCode": "10115"
}limit(optional, default: "1000") - Maximum number of results to returnoffset(optional, default: "0") - Number of results to skip for paginationallowedRetailers(optional, default: []) - Array of retailer names to filter byzipCode(optional, default: "10115") - Postal code for location-based search
Response:
{
"message": "Offers retrieved successfully",
"data": [
{
"title": "Product Name",
"price": "1.99",
"retailer": "Store Name",
...
}
]
}Health check endpoint to verify the API is running.
Response:
ok
curl -X POST http://localhost:3000/offers/pasta \
-H "Content-Type: application/json" \
-d '{
"zipCode": "10115",
"limit": "50"
}'curl -X POST http://localhost:3000/offers/coffee \
-H "Content-Type: application/json" \
-d '{
"allowedRetailers": ["REWE", "EDEKA"],
"zipCode": "10115"
}'GNU GPLv3
Copyright (c) Nusscookie