Skip to content

The backend application is built using .NET 6 and Microsoft SQL Server for data storage. This will serve as a secure gateway between the frontend and the database, handling all data storage and retrieval tasks.

Notifications You must be signed in to change notification settings

N1k0l1n/eCommerce-Website-Backend-DotNet6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eCommerce-backend

eCommerce-backend is a backend web application built with C# that provides API endpoints for an eCommerce website. The application allows users to browse products, add products to their cart, and place orders.

Getting Started

Prerequisites .NET SDK (version 5.0 or higher) A database management system (SQL Server, MySQL, PostgreSQL, etc.)

Installing

Clone the repository:

bash Copy code git clone https://github.com/username/ecommerce-backend.git Navigate to the eCommerce-backend directory:

bash Copy code cd ecommerce-backend/eCommerce-backend Open the appsettings.json file and update the database connection string with your database credentials.

Run the following commands to create and migrate the database:

sql Copy code dotnet ef database update Run the application:

Copy code dotnet run The application should now be running on http://localhost:5000.

Usage

Endpoints The following endpoints are available:

GET /api/products - get a list of all products GET /api/products/{id} - get a specific product by ID POST /api/cart/items - add an item to the user's cart GET /api/cart/items - get a list of items in the user's cart DELETE /api/cart/items/{id} - remove an item from the user's cart POST /api/orders - place an order Authorization To access protected endpoints, you must include a JWT token in the Authorization header of your requests. You can obtain a JWT token by sending a POST request to the /api/auth/login endpoint with a valid username and password.

bash Copy code POST /api/auth/login HTTP/1.1 Content-Type: application/json

{ "username": "user", "password": "password" } The /api/auth/login endpoint returns a JWT token that you can include in the Authorization header of your requests to access protected endpoints.

sql Copy code GET /api/products HTTP/1.1 Authorization: Bearer <jwt_token> Replace <jwt_token> with the token returned by the /api/auth/login endpoint.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

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

About

The backend application is built using .NET 6 and Microsoft SQL Server for data storage. This will serve as a secure gateway between the frontend and the database, handling all data storage and retrieval tasks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages