Skip to content

This is a sample project that implements a RESTful API for managing products. The API allows the creation, retrieval, update, and deletion of products. It also integrates RabbitMQ for publishing product creation events.

BerkayMehmetSert/netCore.RabbitMq

Repository files navigation

.Net core RabbitMQ Example

Description

This is a sample project that implements a RESTful API for managing products. The API allows the creation, retrieval, update, and deletion of products. It also integrates RabbitMQ for publishing product creation events.

Installation

  1. Clone the repository:
git clone 
  1. Install the required packages by running the following command:
dotnet restore
  1. Start the RabbitMQ server using Docker by running the following command:
docker-compose up -d
  1. Run the application by running the following command:
dotnet run

Requirements

Usage

The API supports the following endpoints:

  • POST /api/products - creates a new product
  • PUT /api/products/{id} - updates an existing product
  • 0DELETE /api/products/{id} - deletes a product
  • GET /api/products/{id} - retrieves a product by its ID
  • GET /api/products - retrieves all products

Example

To create a new product, send a POST request to /api/products with the following JSON data in the request body:

{
    "name": "Product Name",
    "description": "Product Description",
    "price": 9.99
}

The API will respond with the following JSON data:

{
    "id": "4e833bf3-9477-4ee8-8b45-d2f28b632d07",
    "name": "Product Name",
    "description": "Product Description",
    "price": 9.99
}

The API will also publish a message to RabbitMQ with the following JSON data:

{
    "id": "4e833bf3-9477-4ee8-8b45-d2f28b632d07",
    "name": "Product Name",
    "description": "Product Description",
    "price": 9.99
}

You can use the RabbitMQ management console to view the published messages. Open a web browser and go to http://localhost:15672/. Log in using the default credentials (guest/guest).

About

This is a sample project that implements a RESTful API for managing products. The API allows the creation, retrieval, update, and deletion of products. It also integrates RabbitMQ for publishing product creation events.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages