Bolero icon indicating copy to clipboard operation
Bolero copied to clipboard

How to decouple Client and Server and deploy them separately?

Open katatunix opened this issue 4 years ago • 2 comments

I created a project from the template dotnet new bolero-app -o mybolero

I tried to decouple the source code of Client and Server by move some F# code (Domain types and Service interfaces) to common F# source files. This works, however I don't know how to break the dependency in the file _Host.cshtml:

<div id="main">@(await Html.RenderComponentAsync<mybolero.Client.Main.MyApp>(BoleroHostConfig))</div>

Then I still figure out how to deploy the Client independently from the Server.

What is your advice?

katatunix avatar Sep 12 '20 07:09 katatunix

I think the dotnet new template creates a 'Blazor WebAssembly Hosted'. To truly break the dependency I think you'd need to use 'Blazor Web Assembly Standalone' and publish the artefacts as a static website.

Rerun your command as

dotnet new bolero-app -o mybolero --server false 

to generate a standalone client and then you can create your server project however you prefer. (Other options described here.)

NickDarvey avatar Sep 12 '20 13:09 NickDarvey

@NickDarvey is correct. If you want a standalone Blazor WebAssembly app, if you look in the Client\wwwroot\index.html, you should see

<script src="_framework/blazor.webassembly.js"></script>

Blazor hosting models

wilsoncg avatar Sep 16 '20 15:09 wilsoncg