Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
/ RestAPIHardwareShop Public archive

This is a sample project designed to learn how to build and work with RESTful APIs using ASP.NET.

License

Notifications You must be signed in to change notification settings

yourlx/RestAPIHardwareShop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rest API Hardware Shop

This is a sample project designed to learn how to build and work with RESTful APIs using ASP.NET.

Table of Contents

Installation and Running

  1. Clone the repository with the application:
git clone https://github.com/yourlx/RestAPIHardwareShop
  1. Navigate to the src folder:
cd src

Local

  1. Make sure that you have .NET 8 SDK and runtime installed. Also, ensure that you have a PostgreSQL instance (local or in a Docker container) running on the same port defined in appsettings.json, or change it to your preferred port.

  2. Run the application:

dotnet run --project HardwareStore.WebApi
  1. Verify that the application is running.

Docker

  1. Make sure that you have Docker (and Docker Compose) installed.

  2. Build the Docker image and run the containers using Docker Compose:

docker-compose up
  1. Ensure that the containers are running using the docker ps command or Docker Desktop.

Usage

To interact with the API, you can use tools like curl, Postman, or the built-in Swagger UI. The Swagger documentation should be available at http://localhost:8080/swagger/index.html.

Example:

  • Get all products:
GET /api/v1/products
  • Create a new product:
POST /api/v1/products
{
  "name": "Wooden Chair",
  "category": "Furniture",
  "price": 15,
  "availableStock": 100,
  "supplierId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

License

This repository code is under MIT License. See LICENSE file for more info.

About

This is a sample project designed to learn how to build and work with RESTful APIs using ASP.NET.

Topics

Resources

License

Stars

Watchers

Forks