API Web ASP.NET Core
Une API bien structurée construite à l'aide des frameworks de base .Net avec certains des modèles de conception les plus populaires.
Forfaits
- AutoMapper.Extensions.Microsoft.DependencyInjection
- Microsoft.AspNetCore.Authentication.JwtBearer
- Microsoft.EntityFrameworkCore
- Microsoft.EntityFrameworkCore.Design
- Microsoft.EntityFrameworkCore.SqlServer
- Microsoft.IdentityModel.Tokens
- Swashbuckle.AspNetCore
- System.IdentityModel.Tokens.Jwt
Migrations
Tout d’abord, assurez-vous que les outils EF (Entity Framework) sont installés en tapant la commande suivante
dotnet tool install --global dotnet-ef
Maintenant, pour migrer, exécutez les commandes suivantes
dotnet ef migrations add InitialMigrations
dotnet ef database update
Points de terminaison
Produits :
- [GET] api/v1/produits/all
- [GET] api/v1/products/get (QUERY)
- [POST] api/v1/products/create (DONNÉES DE FORMULAIRE)
- [POST] api/v1/products/update (QUERY)
- [DELETE] api/v1/products/delete (REQUÊTE)
Catégories :
- [GET] api/v1/categories/all
- [GET] api/v1/categories/get (QUERY)
- [POST] api/v1/categorie/create (QUERY)
- [POST] api/v1/categories/update (QUERY)
- [DELETE] api/v1/categories/delete (REQUÊTE)
Utilisateurs :
- [GET] api/v1/users/{nom d'utilisateur}
- [POST] api/v1/users/update (DONNÉES DE FORMULAIRE)
- [DELETE] api/v1/users/delete (REQUÊTE)
Authentification :
- [GET] api/v1/auth/me (AUTORISATION D'EN-TÊTE) (Jeton du porteur)
- [POST] api/v1/auth/signin (DONNÉES DE FORMULAIRE)
- [POST] api/v1/auth/signup (DONNÉES DE FORMULAIRE)
Stockage et wwwroot
Produits (chaque produit contient jusqu'à 5 images) et stockés dans le chemin :
Utilisateurs (avatar de l'utilisateur) stockés dans le chemin :
Tests d'API (Swagger)
L'API a été intégrée à Swagger afin qu'elle puisse être facilement testée
- https://localhost:5001/swagger/index.html
Pour plus