Skip to content

LojaVirtualAPI is a RESTful API built with ASP.NET Core for managing an online store, featuring JWT authentication and complete CRUD functionality. πŸš€πŸŒ

Notifications You must be signed in to change notification settings

sameterl/LojaVirtualAPI

Repository files navigation

LojaVirtualAPI: Complete RESTful API for E-commerce Management

LojaVirtualAPI

Download Releases

Table of Contents

Overview

LojaVirtualAPI is a robust RESTful API built with ASP.NET Core. It provides a complete solution for managing an online store. This API includes features such as JWT authentication and Swagger documentation, making it easy to integrate and use.

Features

  • Full E-commerce Management: Handle products, categories, orders, and users.
  • JWT Authentication: Secure your API with token-based authentication.
  • Swagger Documentation: Interactive API documentation for easy testing and exploration.
  • Database Integration: Connects seamlessly with SQL Server using Entity Framework.
  • Scalability: Designed to grow with your business needs.

Technologies Used

  • Backend: ASP.NET Core
  • Database: SQL Server
  • ORM: Entity Framework
  • Authentication: JWT
  • API Documentation: Swagger
  • Framework: .NET

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • .NET SDK (version 6.0 or later)
  • SQL Server (Express or higher)
  • A code editor (Visual Studio, Visual Studio Code, etc.)

Installation

  1. Clone the repository:

    git clone https://github.com/sameterl/LojaVirtualAPI.git
  2. Navigate to the project directory:

    cd LojaVirtualAPI
  3. Restore the NuGet packages:

    dotnet restore
  4. Update the database connection string in appsettings.json.

  5. Run the migrations to set up the database:

    dotnet ef database update
  6. Start the application:

    dotnet run

Configuration

Configure the application by editing the appsettings.json file. Here, you can set your database connection string, JWT secret key, and other application settings.

API Documentation

The API is documented using Swagger. Once the application is running, navigate to http://localhost:5000/swagger to access the interactive API documentation. This allows you to test endpoints directly from your browser.

Authentication

The API uses JWT for authentication. To access protected resources, you need to obtain a token by sending a POST request to the /api/auth/login endpoint with valid user credentials.

Example Login Request

POST /api/auth/login
{
  "username": "your_username",
  "password": "your_password"
}

Upon successful login, the API will return a JWT token. Use this token in the Authorization header for subsequent requests.

Endpoints

Here are some key endpoints available in the API:

Products

  • Get All Products

    • Endpoint: GET /api/products
    • Description: Retrieve a list of all products.
  • Get Product by ID

    • Endpoint: GET /api/products/{id}
    • Description: Retrieve a specific product by its ID.
  • Create Product

    • Endpoint: POST /api/products
    • Description: Add a new product to the store.

Categories

  • Get All Categories

    • Endpoint: GET /api/categories
    • Description: Retrieve a list of all categories.
  • Create Category

    • Endpoint: POST /api/categories
    • Description: Add a new category to the store.

Orders

  • Get All Orders

    • Endpoint: GET /api/orders
    • Description: Retrieve a list of all orders.
  • Create Order

    • Endpoint: POST /api/orders
    • Description: Create a new order.

Contributing

Contributions are welcome! If you want to improve this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/YourFeature).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add some feature').
  5. Push to the branch (git push origin feature/YourFeature).
  6. Open a Pull Request.

License

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

For more information, visit the Releases section to download the latest version and execute it.

About

LojaVirtualAPI is a RESTful API built with ASP.NET Core for managing an online store, featuring JWT authentication and complete CRUD functionality. πŸš€πŸŒ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages