Skip to content

mitch-b/dotnet-basic-webapi

Repository files navigation

.NET 7 Minimal API - QuickStart

Quickly clone this repository to get a .NET 7 minimal API which:

  1. Has a basic set of endpoints
  2. Produces OpenApi Explorer
  3. Has dependency injection usage examples ([FromServices])
  4. Demonstrates deprecated API (GetHostInfo2)
  5. Docker container support
  6. Has a basic Filter added (ExceptionFilter)
  7. devcontainer configured - only need container runtime, not dotnet locally installed (TODO)
  8. Has GitHub actions to build a container (TODO)
  9. Has a Client generator (TODO)
  10. Versioned API built-in (TODO)
  11. Has optional authentication/authorization with Azure AD (TODO)

Build & Run Docker container

cd BasicWebApi/
docker build -t dotnet-basic-webapi:latest .
docker run --rm -p 5080:80 dotnet-basic-webapi:latest
open http://localhost:5080/swagger/

Renaming from template:

zsh :

TEMPLATENAME="dotnet-basic-webapi"
NEWNAME="ClonedWebApi"
git clone https://github.com/mitch-b/dotnet-basic-webapi $NEWNAME
# update filenames

find "$NEWNAME" -type f -name "$TEMPLATENAME*" | sed "p;s/$TEMPLATENAME/$NEWNAME/g" | xargs -L2 echo mv
# update namespaces

sed -i -- 's/$TEMPLATENAMESPACE/$NEWNAMESPACE/g' **/*(D.)

PowerShell :

# TODO

Bash :

# TODO

About

QuickStart repo for .NET 7 minimal API with a few bells and whistles to include/exclude based on need

Topics

Resources

License

Stars

Watchers

Forks

Languages