This tutorial will focus on explaining what Blazor is as well as the difference between Blazor server and Blazor web Assembly. Furthermore, it will also explain how to make an API request in Blazor server.
What is Blazor?
Firstly, Blazor is a framework which is used to build UI applications using the .NET framework, C# and HTML. Blazor uses “Components” to hold the code which can be placed inside of other components in order to compartmentalise the code, allowing for smaller more succinct files which can be used as Nuget packages or external libraries. Benefits of Blazor include being able to write C# code that is inline with HTML instead of JavaScript, also, you have the opportunity to take advantage of the wide array of Nuget packages that are on offer, in addition to, the ability to use the scalability and performance benefits that .NET offers.
For this tutorial I will be using a Blazor server application.
Firstly, we will need to create a Blazor project, so open up your editor of choice (mine is Rider) and choose to create a Blazor server application. On Rider there are 2 sections on the left of the wizard when picking a project to create. One for “.NET Core” and a second for “.NET”, I have chosen the “ASP .NET Core Web Application” option and then from the “Type” dropdown pick Blazor…