This template was created in order to facilitate the creation of a dotnet WebApi services, using common dependencies outside of the basic dotnet new webapi template.
Make sure the dotnet sdk is installed by running dotnet --version
on a console.
For installation of latest version, run:
dotnet new -i "WebApiTemplate::*" --nuget-source https://www.myget.org/F/webapitemplate/api/v3/index.json
Currently it lives on the myget source only, since it has such a generic name.
For templates targeting previous versions of dotnet use the version number instead of *
on the installation command:
dotnet version | template version |
---|---|
8.0 | latest |
7.0 | 1.6.9 |
6.0 | 1.3.19 |
5.0 | 1.2.2 |
3.1 | 1.0.16 |
For usage, run:
dotnet new wbapi -o ProjectName
Where Projectname is the name given to the api solution.
The appsettings.json
file includes following configurable props:
- AuthorizationServer - used to configure the Authorization server were the service will revise the token / scope information.
- ConnectionString - used to map from a config file into the startup class the connection information needed to connect to a SQL database.
By default the swagger implementation follows the convention of swagger/v1/swagger.json
for the json file. The root path contains the Swagger-UI webapp.
Usage of the Diagnostics.HealthChecks library is pointing to the /health
url and it contains a very basic validation of uptime, that returns a json indicating the app is healthy.
dotnet new -u WebApiTemplate
The following nuget libraries are included: