Start Blazor WASM from Minimal API - blazor-webassembly

I created a Blazor WASM with asp.net core.
But after a while I wanted to try it with a minimal API (yes it's my first attempt at a minimal API).
What I would like to do is to let the minimal API to start the Blazor WASM part just like it does when I run it with the non minimal API.
Is it possible?

Related

Can we use SignalR in .NET Rest API project?

I have minimal API projects in .NET core 7. The frontend project is separate and created in Vue JS. I need to use SignalR for the notification module, but I can't figure out if this is really possible?
in.NET, all I have is REST APIs for my project, I created an API for SingleR, and it's being called from Vue JS, but the message is not being delivered to the client. Connect ID is being generated. Do I need to create some background services etc. in my understanding, once REST API is being called, it can't be connected forever for WebSocket purpose.

How to add controller support in a Blazor WASM project

I want to have a server web app that serves the code for a Blazor WebAssembly app and also uses controllers to serve data.
So, in a single server app (and in a single executable file), I want to pack the Blazor code that ships to the browser and also have the controllers to respond to HTTP requests.
I was expecting this to be easy to do, but I am honestly lost trying to find how to do this.
The Blazor WASM templates in Visual Studio don't seem to allow this out-of-the-box (the hosting model and what you can do with it is completely different from what you have in web apps) and searching online did not provide any helpful samples on how to do this.
Has anyone done this before?
Note:
I have started with a Blazor app and tried adding controller support to it. Not sure if starting with a web app and trying to add Blazor WebAssembly functionality to it would be easier, but I doubt it...

Best front-end integration of Angular with back end .NET Core API

I'm trying to figure out the best way to integrate a front-end angular application with .net core back end API.
I've already seen two different methods and wondering why use one over the other?
Use the ASP.NET Core with Angular project template (within visual studio) + ASP.NET Core Web API project template.
Use a basic stand alone Angular application + ASP.NET Core Web API project template.
Any thoughts or information is much appreciated!
The Angular project template offers the convenience of managing the two apps (API backend and Angular frontend) as a single unit in one solution, and the project can be built and deployed as a single unit.
If you'd like to create and build the backend and Angular frontend apps separately, and host them on different server or sites, or you just want to create an Angular frontend to consume an existing API(s) backend, you can use Angular CLI to create a customized client app without using the Angular project template.
It's actually very good question, i used to create a stand alone both of front-end and backend parts and work with them separatly. It's makes me able to think only about that part or about only that feature i'm working on whatever it is.

Convert Blazor Server App to Blazor Web-assembly approach

I want to develop an SPA project by Blazor technology.
Due to complexity of debugging the Blazor Web-assembly application, I would like to first create it as a server-side app, and then later change it to a Web-assembly application app.
Is this possible? If so, after I have successfully gotten the Server-side Blazor project to work, what changes will I need to make, to get the same functionality working with the WebAssembly project?
Also, are there any particular approaches or technologies I should avoid in my Server-side Blazor project, because they have no equivalent when using WebAssembly?
For the most part, your Blazor components should be able to migrate from Server to Webassembly with few or no changes.
If your Blazor Server application doesn't require data from outside your application (e.g. database calls), and it doesn't use any APIs that aren't supported in the browser (e.g. System.Security.Cryptography), then you may be able to migrate to Blazor Webassembly without any changes to your components.
If your Blazor Server application does require data from outside the browser, then those services will need to be hosted elsewhere and called from your components via Http requests (see Call a web API from ASP.NET Core Blazor).
There are a couple of good options for your Blazor Webassembly back-end, the most common of which is the Blazor Webassembly hosted template.
If you'd rather serve your Webassembly app as a static web application, you can instead move your back-end services to a serverless function application. There are a variety of options for that, the most convenient of which (in my opinion) is using Azure Static Web Apps with .NET and Blazor

How to configure middleware inside a .NET MVC 5 Web App?

I need to run a program that fetches info from a REST API every 10 seconds and then posts it to an Action in my MVC 5 Web App.
So far, the best solution I've come up with is to run the Web App and then, parallel to it, a Console Application that works as this middleware, fetching the API and Posting to the Action on the Web App.
I figured a better solution would be to execute the code that powers the Console App directly inside the MVC 5 App, this way only the Web App would be executed, and the code could work on the background, fetching and posting the data.
I noticed that when you create a new project, and select Console Application, you can add it to an existing Solution. Would this enable the behavior described above?
How can I achive this behavior on the ASP.NET MVC 5 framework?

Resources