Todo REST API samples using ASP.NET Core minimal APIs. It showcases:
- Using EntityFramework and PostgreSQL for data access
- JWT authentication
- OpenAPI support
- API Versioning
- Writing tests for your REST API
- HTTP2 ready
- PostgreSQL intance: browse
Docker
folder and rundocker-start.bat
for Windowsdocker-start.sh
for Linux/MacOS
- Install the dotnet-ef tool:
dotnet tool install dotnet-ef -g
- Navigate to the
TodoApi
folder and rundotnet ef database update
to create the database. - Learn more about dotnet-ef
- Run
dotnet user-jwts create
to create a JWT token for your user anddotnet user-jwts create -n admin --role admin
to create an admin user. - You should be able to use these tokens to make authenticated requests to the endpoint.
- Learn more about user-jwts
TodoApi uses OpenTelemetry to collect logs, metrics and spans. If you wish to view the collected telemetry, follow the steps below.
- Prometheus is included in Docker Compose
- Open Prometheus in your browser
- Query the collected metrics
- Jaeger is included in Docker Compose
- Uncomment
.AddOtlpExporter
belowbuilder.Services.AddOpenTelemetryTracing
, in theTodoApi/OpenTelemetryExtensions.cs
file - Open Jaeger in your browser
- View the collected spans
- Install k6
- Browse
LoadTesting
folder - Execute load test from terminal with
k6 run script.js