chapter two

2 Your first Blazor app

 

This chapter covers

  • Choosing the right project template for your application
  • Building and running your application
  • Understanding the key parts of your application
  • Writing your first components

After chapter 1, you should have a good overview of what Blazor is and how it works, a high-level understanding of the concept of hosting models, as well as some compelling reason why you might want to choose Blazor for your next project. But so far, we’ve only talked in theory; we’ve not got our hands dirty building anything with Blazor. That’s all going to change in this chapter.

We’re going to create the application that we’ll be building throughout the rest of the book, Blazing Trails! The app will allow walkers to discover new routes to explore as well as add and update routes of their own. As we build this app you will learn about the key features of Blazor, things such as routing, forms and validation, and authentication.

2.1   Setting up the application

2.1.1   Blazor WebAssembly template configurations

2.1.2   Creating the application

2.2   Building and running the application

2.3   Key components of a Blazor application

2.3.1   Index.html

2.3.2   Program.cs

2.3.3   App.razor

2.3.4   wwwroot folder & _imports.razor

2.4   Writing your first components

2.4.1   Organizing files using feature folders

2.4.2   Defining the layout

2.4.3   The Blazing Trails home page

2.5   Summary