forked from jakub/dotnettest
Initial Blazor Server Drone demo
This commit is contained in:
9
MyBlazorApp/App.razor
Normal file
9
MyBlazorApp/App.razor
Normal file
@@ -0,0 +1,9 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<h1>Page not found</h1>
|
||||
</NotFound>
|
||||
</Router>
|
||||
|
||||
6
MyBlazorApp/MyBlazorApp.csproj
Normal file
6
MyBlazorApp/MyBlazorApp.csproj
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
3
MyBlazorApp/Pages/Index.razor
Normal file
3
MyBlazorApp/Pages/Index.razor
Normal file
@@ -0,0 +1,3 @@
|
||||
@page "/"
|
||||
|
||||
<h1>Hello, Blazor world!</h1>
|
||||
23
MyBlazorApp/Pages/_Host.cshtml
Normal file
23
MyBlazorApp/Pages/_Host.cshtml
Normal file
@@ -0,0 +1,23 @@
|
||||
@page "/"
|
||||
@namespace MyBlazorApp.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Hello Blazor</title>
|
||||
<base href="~/" />
|
||||
</head>
|
||||
<body>
|
||||
<app>
|
||||
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
||||
</app>
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
18
MyBlazorApp/Program.cs
Normal file
18
MyBlazorApp/Program.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
var app = builder.Build();
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
}
|
||||
app.UseStaticFiles();
|
||||
app.UseRouting();
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
app.Run();
|
||||
|
||||
9
MyBlazorApp/_Imports.razor
Normal file
9
MyBlazorApp/_Imports.razor
Normal file
@@ -0,0 +1,9 @@
|
||||
@using System.Net.Http
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using MyBlazorApp
|
||||
|
||||
Reference in New Issue
Block a user