This Project based on patrickgod/dotnet7-rpg project.
It showcases:
- Blazor WebAssembly
- Minimal APIs
- Using EntityFramework and SQL Server for data access
- JWT authentication
- Install the dotnet-ef tool:
dotnet tool install dotnet-ef -g
- Run
dotnet ef database update
to create the database. Learn more about dotnet-ef
-
To initialize the keys for JWT generation, run
dotnet user-jwts
in to TodoApi folder:dotnet user-jwts create
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.
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.
-
To create a new user, run the application and POST a JSON payload to
/users
endpoint:{ "username": "myuser", "password": "<put a password here>" }
-
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
-
You should be able to use this token to make authenticated requests to the todo endpoints.
-
Learn more about user-jwts