Coder Social home page Coder Social logo

berkaymehmetsert / net.hangfire.logging Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 16 KB

This project showcases a basic implementation of a Hangfire application. It provides an API for managing products, allowing users to create, update, and delete products, as well as sort products based on their prices.

C# 100.00%

net.hangfire.logging's Introduction

Net Hangfire Logging Example

This project showcases a basic implementation of a Hangfire application. It provides an API for managing products, allowing users to create, update, and delete products, as well as sort products based on their prices. Along with Hangfire, a task is created to periodically monitor the total number of products in the database and log it. This task runs every 1 minute and provides real-time insights into the product count. The integration of Hangfire enables efficient background job scheduling and execution, ensuring seamless product management and automatic monitoring of the product count.

Installing

  1. Clone the repository
git clone https://github.com/BerkayMehmetSert/net.Hangfire.Logging.git
  1. Install dependencies
dotnet restore
  1. Create a database in SQL Server
CREATE DATABASE HangFireDb
  1. Run the project
dotnet run
  1. Open Hangfire Dashboard in your browser
http://localhost:5228/hangfire

Usage

Get all products

GET /api/product

Response body:

{
  "success": true,
  "message": "Products retrieved successfully",
  "data": [
    {
      "id": "4b4663fb-a819-413e-9d15-bd0b577138a1",
      "name": "Product 1",
      "description": "Description 1",
      "price": 100
    },
    {
      "id": "ef481be9-7363-4420-b62a-546d2a93420b",
      "name": "Product 2",
      "description": "Description 2",
      "price": 110
    }
  ]
}

Get product by id

GET /api/product/{id}

Response body:

{
  "success": true,
  "message": "Product retrieved successfully",
  "data": {
    "id": "4b4663fb-a819-413e-9d15-bd0b577138a1",
    "name": "Product 1",
    "description": "Description 1",
    "price": 100
  }
}

Get product by name

GET /api/product/name/{name}

Response body:

{
  "success": true,
  "message": "Product retrieved successfully",
  "data": {
    "id": "4b4663fb-a819-413e-9d15-bd0b577138a1",
    "name": "Product 1",
    "description": "Description 1",
    "price": 100
  }
}

Get products descending by price

GET /api/product/price/descending

Response body:

{
  "success": true,
  "message": "Products retrieved successfully",
  "data": [
    {
      "id": "ef481be9-7363-4420-b62a-546d2a93420b",
      "name": "Product 2",
      "description": "Description 2",
      "price": 110
    }
    {
      "id": "4b4663fb-a819-413e-9d15-bd0b577138a1",
      "name": "Product 1",
      "description": "Description 1",
      "price": 100
    }
  ]
}

Get products ascending by price

GET /api/product/price/ascending

Response body:

{
  "success": true,
  "message": "Products retrieved successfully",
  "data": [
    {
      "id": "4b4663fb-a819-413e-9d15-bd0b577138a1",
      "name": "Product 1",
      "description": "Description 1",
      "price": 100
    },
    {
      "id": "ef481be9-7363-4420-b62a-546d2a93420b",
      "name": "Product 2",
      "description": "Description 2",
      "price": 110
    }
  ]
}

Create product

POST /api/product

Request body:

{
  "name": "Product 1",
  "description": "Description 1",
  "price": 100
}

Response body:

{
  "success": true,
  "message": "Product created successfully"
}

Update product

PUT /api/product/{id}

Request body:

{
  "name": "Product 1",
  "description": "Description 1",
  "price": 110
}

Response body:

{
  "success": true,
  "message": "Product updated successfully"
}

Delete product

DELETE /api/product/{id}

Response body:

{
  "success": true,
  "message": "Product deleted successfully"
}

net.hangfire.logging's People

Contributors

berkaymehmetsert avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.