Skip to content

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

Notifications You must be signed in to change notification settings

jbenzshawel/WebApiScaffold

Repository files navigation

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published