Bolero
Bolero copied to clipboard
How to decouple Client and Server and deploy them separately?
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?
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 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>