ElGuerre.ApiRest.Template
1.0.0-Beta1
See the version list below for details.
dotnet new install ElGuerre.ApiRest.Template::1.0.0-Beta1
Dot Net Api Rest Basic Template
Is a AspNet Core (API Rest) template to provide Best Practices and use several professional componentes and much more. Also to know how DotNet Templates work.
API project structure:
- Application
- Models. Models, ViewModels and DTOs used by Controllers and Services.
- Services. Application Logic.
- Controllers (Think controllers)
- Domain
- Exceptions.
- Interfaces.
- Infrastructure
- ActionResults
- EntityConfigurations. EF programatically configuration.
- Filters. ASPNet Core Filteres.
- Http. Client to invoque other API Rests.
- Middlewares.
- Providers.
- Repositories. DB repositories to use EF easyly in an isolatted layer.
k8s folder Kubernetes and helm ".YAML" configuration to publish API to Kubernetes.
azure folder Azure resources scripts to register App in Azure Active Directory (AAD). other scripts, like ARM (Azure Resource Manager), could be added here.
What is going to Learn?
- DotNet Templates
- API REST using NetCore and best practices:
- Swagger
- Serilog and also 'ApplicationInsight' + Serilog Extensions.
- Entity Framework Core for Commands.
- Automapper. Optional to map Model/entities.
- Entity Framework.
- HelthChecks.
- Authenticaction (via AAD).
- Docker
- Kubernetes and Helm
- Azure Pipelines
- And much more.
Blog
All those new Patterns, Tools and Platforms, will be Blog Post entries in elGuerre.com
Runnng the App
- Using Kestrel from Visual Studio:
xxx
- Using Docker from Visual Studio or Docker Command Line:
xxx
- Run Entity Framework Migration:
cd ElGuerre.Items.Api
dotnet ef migrations add Init --startup-project ..\src\ElGuerre.Items.Api.csproj
dotnet ef database update --startup-project ..\src\ElGuerre.Items.Api.csproj
Generate and publish Template
Package a new template version
Nuget.exe pack ElGuerre.ApiRest.Template.nuspec -Version 1.0.n
Nuget.org
dotnet nuget push AppLogger.1.0.0.nupkg -k xxx -s https://api.nuget.org/v3/index.json
Github (Packages)
Update Nuget.config
- Update
%APPDATA%\NuGet\NuGet.config
and delete properties "github". - Set or updated Nuget.config properties with the password already got in the previous steps
nuget.exe sources Add -Name github -Source https://nuget.pkg.github.com/juanluelguerre/index.json -username ### USERNAME ### -password ### TOKEN ###
Note TOKEN will be generated as follow. More details here.
PUblish a new template version
dotnet nuget push "ElGuerre.Items.API.1.0.0.nupkg" --source "github"
Publish a new template version
dotnet nuget push --source github ElGuerre.Items.API.1.0.n.nupkg
ornuget.exe push -Source github ElGuerre.Items.API.1.0.n.nupkg
Azure DevOps (Artifacts)
Generate a new token
- %USERPROFILE%.nuget\plugins\netfx\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe -U https://pkgs.dev.azure.com/JuanluElGuerre/elGuerre/_packaging/templates/nuget/v3/index.json
Update Nuget.config
- Update
%APPDATA%\NuGet\NuGet.config
and delete properties "templates". - Set or updated Nuget.config properties with the password already got in the previous steps
nuget.exe sources Add -Name templates -Source https://pkgs.dev.azure.com/JuanluElGuerre/elGuerre/_packaging/Templates/nuget/v3/index.json -username unused -password ### TOKEN ###
Publish a new template version
- nuget.exe push -source templates -ApiKey AzureDevOps ElGuerre.Items.API.1.0.n.nupkg
Install and uninstall templates
Clear cache: dotnet nuget locals http-cache --clear
Add new templates dotnet new -i ElGuerre.Items.API::*
Note: List of templeates cached: dotnet nuget locals all --list
Note: Remove cached of templatess Http and Temps: dotnet nuget locals http-cache --clear
y dotnet nuget locals temp --clear
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 2,240 | 4/2/2021 |
1.0.0-Beta2 | 383 | 1/27/2020 |
1.0.0-Beta1 | 428 | 1/26/2020 |