This repository contains the website https://suadin.de/ which based on Blazor WebAssembly with aim to use it as sandbox to practise full-stack-developer topics outside of restricted environments.
- Blazor WebAssembly: project template, run .NET C# code on client, less server communication
- SignalR: bidirectional communication between client and server
- Bootstrap: responsive design
- Open Iconic: icon set
choco install visualstudio2019community
, ensure .NET 5 is installed, ensure ASP.NET and .NET core features are enabledchoco install docker-for-windows
, ensure virtualization (in bios) is enabled, ensuredocker run -d -p 80:80 docker/getting-started
works, run dockerchoco install gitkraken
(optional), good tree-overview and diff-tool- run website: clone project, open visual studio, add credentials
dotnet user-secrets set "Authentication:Google:ClientSecret" "client_secret"
- run as docker, start of container is already configured [source]
- expect browser opens https://localhost:8443/
- build & deploy: push changes on main branch and expect https://suadin.de/ gets changes [details]
- create css variables for dark/light mode [source]
- you can select theme on operating system, for example in windows 10 [source]
- use
@media(prefers-color-scheme): dark|light|no-preference
to use theme from operating systems settings in website [source]
- Setup Server Project [source]
- add website url https://suadin.de for prod, https://localhost:8443 for development
- add callback url https://suadin.de/authentication/login-callback for prod, https://localhost:8443/authentication/login-callback for development
- set
Client-ID
intoappsettings.json
- set
Client-Secret
intouser secrets
for development [source], intodocker environment varibales
for prod [details]
- Setup Client Project [source]
- Use auth feature by example [source]
- HTML keywords:
<AuthorizeView>
(parent),<Authorized>
(only authenticated),<NotAuthorized>
(only anonymous) - HTML user name:
@context.User.Identity.Name
- C# user name:
[CascadingParameter] public Task<AuthenticationState> AuthState { get; set; }
->(await AuthState).User.Identity.Name;
- HTML keywords:
TODO: needs refactoring! [source]
TODO