jbenzshawel / WebApiScaffold

ASP.NET Core dotnet new template for scaffolding Web API projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web API Scaffold

ASP.NET Core dotnet new template for scaffolding Web API projects. Default implementation includes Bearer Token authentication. Optional parameters for configuring Docker, Entity Framework Core, and NLog.

Example:

dotnet new apiscaffold -D -E -N

Options

-D|--Docker

  • bool - Optional
  • Default: false / (*) true

-E|--EntityFramework : When set to true configures app to use Entity Framework Core

  • bool - Optional
  • Default: false / (*) true

-N|--NLog : When set to true configures app to use NLog

  • bool - Optional
  • Default: false / (*) true

(* Indicates the value used if the switch is provided without a value.)

Template Installation

After getting the project from git install the dotnet new template using the --install option. For example:

dotnet new --install ~/Projects/dotnet/Templates/WebApiScaffold/

Running in Docker

To run the solution in docker use the following commands.

docker build --pull -t aspnetapp .
docker run --name example --rm -it -p 8000:80 aspnetapp

App Settings Configuration

Settings for JWT TokenLifeInMinutes, TokenAudience, and TokenIssuer are set in appsettings.json. For development Token Secret and Connetion Strings are stored using app secrets.

Example:

dotnet user-secrets set "JwtSettings:TokenSecret" "YOUR SECRET STRING"
dotnet user-secrets set "ConnectionStrings:AppDatabase" "YOUR CONNECTION STRING"

About

ASP.NET Core dotnet new template for scaffolding Web API projects


Languages

Language:C# 94.1%Language:Dockerfile 5.9%