iamsaikat / dotnet-rpg-api

RPG Game API application with ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo RPG Game API application with ASP.NET Core

This Project based on patrickgod/dotnet7-rpg project.

It showcases:

  • Blazor WebAssembly
  • Minimal APIs
  • Using EntityFramework and SQL Server for data access
  • JWT authentication

Prerequisites

.NET

  1. Install .NET 7

Database

  1. Install the dotnet-ef tool: dotnet tool install dotnet-ef -g
  2. Run dotnet ef database update to create the database. Learn more about dotnet-ef

JWT

  1. To initialize the keys for JWT generation, run dotnet user-jwts in to TodoApi folder:

    dotnet user-jwts create
    

Running the application

To run the application:

  • Visual Studio Code - Open up terminal windows, on root dir run:

    dotnet watch run
    

This will run application with hot reload.

Optional

Using the API standalone

The Todo REST API can run standalone as well. You can run the project and make requests to various endpoints using the Swagger UI (or a client of your choice):

Before executing any requests, you need to create a user and get an auth token.

  1. To create a new user, run the application and POST a JSON payload to /users endpoint:

    {
      "username": "myuser",
      "password": "<put a password here>"
    }
  2. To get a token for the above user run dotnet user-jwts to create a JWT token with the same user name specified above e.g:

    dotnet user-jwts create -n myuser
    
  3. You should be able to use this token to make authenticated requests to the todo endpoints.

  4. Learn more about user-jwts

About

RPG Game API application with ASP.NET Core


Languages

Language:C# 100.0%