Project Structure
├──Program.cs
— entrypoint; host; startup
- Calls
MapBlazorHub
to set up an endpoint for the real-time communication w/browser (via SignalR) - Calls
MapFallbackToPage("/_Host")
to set the root page (Pages/_Host.cshtml
) and enable nav.
├──appsettings.json
— environmental app settings├──App.razor
— the root component
- Sets up client-side routing using the Router component;
- Router intercepts browser navigation and renders the page that matches the requested address
├──_Imports.razor
— global namespaces made available to all components├──wwwroot
— the web root├──Shared/
├──MainLayout.razor
— the app’s layout component
└──MainLayout.razor.css
— stylesheet for the above layout
└──NavMenu.razor
— implements sidebar navigation; includes NavLink component which renders navigation links to other components
└──NavMenu.razor.css
— stylesheet for the above
└──SurveyPrompt.razor
— Blazor survey component├──Properties/launchSettings.json
— development environment configuration├──Pages/
— Blazor components are hosted here
└──_Host.cshtml
— root page of the app;
- When any page is initially requested, this page is rendered and returned in the response;
- Specifies where the root component (App.razor
) is rendered
- <head>
is located here
- References _Layout
├──_Layout.cshtml
- @RenderBody()
is located here
- References _framework/blazor.server.js
(establishes SignalR connection)
└──Counter.razor
— the Counter page
└──Error.razor
— rendered when an unhandled exception occurs
└──FetchData.razor
— the Fetch Data page
└──Index.razor
— the home pageData/
— WeatherForecast
class and implementation of WeatherForecastService
that provides example weather data to app’s FetchData
component.