Code Monkey home page Code Monkey logo

minimalapidemo's Introduction

Todo REST MINIMAL API

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

Prerequisites

.NET

  1. Install .NET 7

Database

  1. PostgreSQL intance: browse Docker folder and run
    • docker-start.bat for Windows
    • docker-start.sh for Linux/MacOS
  2. Install the dotnet-ef tool: dotnet tool install dotnet-ef -g
  3. Navigate to the TodoApi folder and run dotnet ef database update to create the database.
  4. Learn more about dotnet-ef

Authentication

  1. Run dotnet user-jwts create to create a JWT token for your user and dotnet user-jwts create -n admin --role admin to create an admin user.
  2. You should be able to use these tokens to make authenticated requests to the endpoint.
  3. Learn more about user-jwts

Optional

OpenTelemetry

TodoApi uses OpenTelemetry to collect logs, metrics and spans. If you wish to view the collected telemetry, follow the steps below.

Metrics

  1. Prometheus is included in Docker Compose
  2. Open Prometheus in your browser
  3. Query the collected metrics

Distributed trace

  1. Jaeger is included in Docker Compose
  2. Uncomment .AddOtlpExporter below builder.Services.AddOpenTelemetryTracing, in the TodoApi/OpenTelemetryExtensions.cs file
  3. Open Jaeger in your browser
  4. View the collected spans

Load Testing

K6

  1. Install k6
  2. Browse LoadTesting folder
  3. Execute load test from terminal with k6 run script.js

minimalapidemo's People

Contributors

deadvi5 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.