blazor server or wasm if I have existing Api?

Emil Alipiev 271 Reputation points
2023-10-05T10:50:13.66+00:00

Hi,

If i have an existing Api and i want to develop a front end with some native capabilities what is the best app type. I will probably need a camera to scan things. Is it require me to use Hybrid app or i can achieve also with Wasm or Server side blazor? I see that .net 8 offers a mix type. Can this be a good candidate because I want generally served on the server but only some pages should have offline capabilities.
So can i start today with .net 8 as a Server side blazor app and achieve 1-2 pages only as Wasm with Offline capability?
Having an existing Api on a different domain except CORS, will I have any issue or is it better to host them together on a same domain?
Thanks.

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,415 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 57,646 Reputation points
    2023-10-05T17:23:40.5966667+00:00

    if web hosted either Blazor server or WASM, then your code is limited to the browsers api which it would access via jsinterop:

    https://developer.mozilla.org/en-US/docs/Web/API/Media_Capture_and_Streams_API

    if you create an actual mobile app with Maui (or Maui Blazor hybrid), you can call the native sdk.

    you would need to write two blazor apps to have some pages be WASM and some server. while the Blazer server site could host the WASM static content, there is no template for this.

    Blazor server does not support offline, and requires a very reliable connection.

    note: to build Maui apps for IOS requires a Mac to do the builds and an Apple developer license.

    1 person found this answer helpful.