From 62ea632a50f24cb7598331d2da23bdccf68d3b87 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Tue, 30 Jun 2026 18:18:32 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Blazor=20WebAssembly=20=ED=81=B4?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EC=96=B8=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TaxBaik.Web.Client/Pages/WasmPing.razor | 13 ++++++++++++ TaxBaik.Web.Client/Program.cs | 17 ++++++++++++++++ TaxBaik.Web.Client/TaxBaik.Web.Client.csproj | 21 ++++++++++++++++++++ TaxBaik.Web.Client/_Imports.razor | 13 ++++++++++++ TaxBaik.Web/Program.cs | 6 +++++- TaxBaik.Web/TaxBaik.Web.csproj | 2 ++ TaxBaik.sln | 14 +++++++++++++ 7 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 TaxBaik.Web.Client/Pages/WasmPing.razor create mode 100644 TaxBaik.Web.Client/Program.cs create mode 100644 TaxBaik.Web.Client/TaxBaik.Web.Client.csproj create mode 100644 TaxBaik.Web.Client/_Imports.razor diff --git a/TaxBaik.Web.Client/Pages/WasmPing.razor b/TaxBaik.Web.Client/Pages/WasmPing.razor new file mode 100644 index 0000000..aeafb41 --- /dev/null +++ b/TaxBaik.Web.Client/Pages/WasmPing.razor @@ -0,0 +1,13 @@ +@* WASM 기반(M3) 검증용 컴포넌트. 라우팅/렌더모드 전면 적용은 M4에서 처리한다. *@ +@rendermode InteractiveWebAssembly + + + WebAssembly 렌더 모드 점검 + 이 컴포넌트가 클릭에 반응하면 Interactive WebAssembly 기반이 정상 동작하는 것입니다. + 카운트: @count + + +@code { + private int count; + private void Increment() => count++; +} diff --git a/TaxBaik.Web.Client/Program.cs b/TaxBaik.Web.Client/Program.cs new file mode 100644 index 0000000..44d5361 --- /dev/null +++ b/TaxBaik.Web.Client/Program.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using MudBlazor.Services; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +// MudBlazor (WASM 측 인터랙티브 컴포넌트용) +builder.Services.AddMudServices(); + +// API 호출용 HttpClient — 호스트 base(`/taxbaik/`) 기준 +builder.Services.AddScoped(sp => new HttpClient +{ + BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) +}); + +builder.Services.AddAuthorizationCore(); + +await builder.Build().RunAsync(); diff --git a/TaxBaik.Web.Client/TaxBaik.Web.Client.csproj b/TaxBaik.Web.Client/TaxBaik.Web.Client.csproj new file mode 100644 index 0000000..a427452 --- /dev/null +++ b/TaxBaik.Web.Client/TaxBaik.Web.Client.csproj @@ -0,0 +1,21 @@ + + + + net10.0 + enable + enable + TaxBaik.WasmClient + + + + + + + + + + + + + + diff --git a/TaxBaik.Web.Client/_Imports.razor b/TaxBaik.Web.Client/_Imports.razor new file mode 100644 index 0000000..aa7052b --- /dev/null +++ b/TaxBaik.Web.Client/_Imports.razor @@ -0,0 +1,13 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Components.Authorization +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.AspNetCore.Components.WebAssembly.Http +@using Microsoft.JSInterop +@using MudBlazor +@using TaxBaik.WasmClient +@using static Microsoft.AspNetCore.Components.Web.RenderMode diff --git a/TaxBaik.Web/Program.cs b/TaxBaik.Web/Program.cs index 89308fe..aba1af5 100644 --- a/TaxBaik.Web/Program.cs +++ b/TaxBaik.Web/Program.cs @@ -54,7 +54,9 @@ builder.Services.AddHealthChecks(); // Razor Pages + Blazor Server 통합 builder.Services.AddRazorPages(); -builder.Services.AddRazorComponents().AddInteractiveServerComponents(); +builder.Services.AddRazorComponents() + .AddInteractiveServerComponents() + .AddInteractiveWebAssemblyComponents(); builder.Services.Configure(options => { options.DetailedErrors = true; @@ -348,6 +350,8 @@ app.MapRazorPages(); // 인증은 Blazor AuthorizeRouteView → RedirectToLogin 에서 처리한다. app.MapRazorComponents() .AddInteractiveServerRenderMode() + .AddInteractiveWebAssemblyRenderMode() + .AddAdditionalAssemblies(typeof(TaxBaik.WasmClient._Imports).Assembly) .AllowAnonymous(); // 애플리케이션 시작/종료 로깅 diff --git a/TaxBaik.Web/TaxBaik.Web.csproj b/TaxBaik.Web/TaxBaik.Web.csproj index f14e1ea..0af16c5 100644 --- a/TaxBaik.Web/TaxBaik.Web.csproj +++ b/TaxBaik.Web/TaxBaik.Web.csproj @@ -3,6 +3,7 @@ + @@ -12,6 +13,7 @@ + diff --git a/TaxBaik.sln b/TaxBaik.sln index 10b5d07..080f874 100644 --- a/TaxBaik.sln +++ b/TaxBaik.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaxBaik.Web", "TaxBaik.Web\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaxBaik.Application.Tests", "TaxBaik.Application.Tests\TaxBaik.Application.Tests.csproj", "{47D1F07D-F11B-4343-A3C3-1872F0C46AE3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaxBaik.Web.Client", "TaxBaik.Web.Client\TaxBaik.Web.Client.csproj", "{F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -83,6 +85,18 @@ Global {47D1F07D-F11B-4343-A3C3-1872F0C46AE3}.Release|x64.Build.0 = Release|Any CPU {47D1F07D-F11B-4343-A3C3-1872F0C46AE3}.Release|x86.ActiveCfg = Release|Any CPU {47D1F07D-F11B-4343-A3C3-1872F0C46AE3}.Release|x86.Build.0 = Release|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Debug|x64.ActiveCfg = Debug|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Debug|x64.Build.0 = Debug|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Debug|x86.ActiveCfg = Debug|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Debug|x86.Build.0 = Debug|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Release|Any CPU.Build.0 = Release|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Release|x64.ActiveCfg = Release|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Release|x64.Build.0 = Release|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Release|x86.ActiveCfg = Release|Any CPU + {F3DEFE23-E849-4BE6-9E18-C1AF1CDDC7EB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE