Skip to content

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.

License

Notifications You must be signed in to change notification settings

hugueslopezpardo/nestjs-api-products

Repository files navigation

NestJS Products API

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.

Technologies

NestJS TypeScript GraphQL Apollo-GraphQL MongoDB

Table of Contents

Features

  • Create, read, update, and delete (CRUD) products
  • GraphQL API for easy data manipulation
  • TypeScript for type safety
  • Validation of input data

Setup

  1. Clone the repository:

     git clone https://github.com/hugueslopezpardo/nestjs-api-products.git
  2. Navigate to the project directory:

     cd nestjs-api-products

Running the Application

  1. Run the application:

     docker-compose up -d
  2. Access GraphQL Playground:

    • Open your browser and go to http://localhost:3000/graphql to access the GraphQL playground.

GraphQL Queries and Mutations

1. Create Product Mutation

mutation {
  createProduct(createProductInput: {
    name: "Sample Product",
    price: 19.99,
    description: "This is a sample product."
  }) {
    id
    name
    price
    description
  }
}

2. Get All Products Query

query {
  products {
    id
    name
    price
    description
  }
}

3. Get Product by ID Query

query {
  product(id: 1) {
    id
    name
    price
    description
  }
}

4. Update Product Mutation

mutation {
  updateProduct(updateProductInput: {
    id: 1,
    name: "Updated Product Name",
    price: 24.99,
    description: "Updated description for the product."
  }) {
    id
    name
    price
    description
  }
}

5. Remove Product Mutation

mutation {
  removeProduct(id: 1) {
    id
    name
  }
}

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published