This application uses GraphQL to serve product data.
To start the GraphQL server, run:
npm run dev:serverThe server will start on http://localhost:4000/graphql
In a separate terminal, start the React development server:
npm run devThe application will connect to the GraphQL server at http://localhost:4000/graphql by default.
You can configure the GraphQL server URL by setting the VITE_GRAPHQL_URL environment variable:
VITE_GRAPHQL_URL=http://localhost:4000/graphql npm run devThe GraphQL schema defines the following types:
Product: Represents a product with id, name, category, price, image, description, badge, featured status, and colorsQuery:products: Returns all productsproduct(id: ID!): Returns a single product by ID
query GetProducts {
products {
id
name
category
price
image
description
badge
featured
colors
}
}