This project is a RESTful API built with NestJS for managing products. It allows users to create, read, update, and delete products. The API uses GraphQL for query handling.
- Features
- Technologies
- Setup
- Running the Application
- GraphQL Queries and Mutations
- Contributing
- License
- Create, read, update, and delete (CRUD) products
- GraphQL API for easy data manipulation
- TypeScript for type safety
- Validation of input data
-
Clone the repository:
git clone https://github.com/hugueslopezpardo/nestjs-api-products.git
-
Navigate to the project directory:
cd nestjs-api-products
-
Run the application:
docker-compose up -d
-
Access GraphQL Playground:
- Open your browser and go to
http://localhost:3000/graphql
to access the GraphQL playground.
- Open your browser and go to
mutation {
createProduct(createProductInput: {
name: "Sample Product",
price: 19.99,
description: "This is a sample product."
}) {
id
name
price
description
}
}
query {
products {
id
name
price
description
}
}
query {
product(id: 1) {
id
name
price
description
}
}
mutation {
updateProduct(updateProductInput: {
id: 1,
name: "Updated Product Name",
price: 24.99,
description: "Updated description for the product."
}) {
id
name
price
description
}
}
mutation {
removeProduct(id: 1) {
id
name
}
}
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.