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
Dockerfolder and rundocker-start.batfor Windowsdocker-start.shfor Linux/MacOS
- Install the dotnet-ef tool:
dotnet tool install dotnet-ef -g - Navigate to the
TodoApifolder and rundotnet ef database updateto create the database. - Learn more about dotnet-ef
- Run
dotnet user-jwts createto create a JWT token for your user anddotnet user-jwts create -n admin --role adminto 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
.AddOtlpExporterbelowbuilder.Services.AddOpenTelemetryTracing, in theTodoApi/OpenTelemetryExtensions.csfile - Open Jaeger in your browser
- View the collected spans
- Install k6
- Browse
LoadTestingfolder - Execute load test from terminal with
k6 run script.js