# README
Product Search
The Products Search service is a GraphQL API written in Go and containerized with Docker. It's purpose is to facilitate customer queries for available products and product collections. It is a fundamental part of our E-commerce platform within the DistributedPlayground project. See the project description for more details.
Service Architecture
I chose a GraphQL API for this service because GraphQL allows flexible and easily extensible queries into complex data sets. This query flexibilty can lead to a reduction in overall network calls and volume of network data transferred relative to REST.
Endpoint Description
Operation | Endpoint | Description | Parameters | Return Type |
---|---|---|---|---|
Query | collections | Retrieves a list of collections. | limit, offset | [Collection!]! |
Query | products | Retrieves a list of products. | limit, offset | [Product!]! |
Query | collection | Retrieves a specific collection by ID. | id | Collection! |
Query | product | Retrieves a specific product by ID. | id | Product! |
Request Parameters Examples:
- limit: Integer (e.g., 10)
- offset: Integer (e.g., 0)
- id: ID! (e.g., "abc123")
Query Examples:
- Fetching a list of collections:
query {
collections(limit: 10, offset: 0) {
id
name
description
}
}
- Fetching a list of products:
query {
products(limit: 10, offset: 0) {
id
name
description
price
quantity
collection {
name
}
}
}
- Fetching a specific collection:
query {
collection(id: "<collection-id>") {
id
name
description
}
}
- Fetching a specific product:
query {
product(id: "product-id-here") {
id
name
description
price
quantity
collection {
name
}
}
}
Running the Service
Follow the instructions in the DistributedPlayground project description.