Categorygithub.com/DistributedPlayground/product-search
repository
0.0.0-20231007225130-a02a8deef04b
Repository: https://github.com/distributedplayground/product-search.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# 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

OperationEndpointDescriptionParametersReturn Type
QuerycollectionsRetrieves a list of collections.limit, offset[Collection!]!
QueryproductsRetrieves a list of products.limit, offset[Product!]!
QuerycollectionRetrieves a specific collection by ID.idCollection!
QueryproductRetrieves a specific product by ID.idProduct!

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.