From the course: Migrating ASP.NET Core Web Applications to Azure

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Calling Azure Functions from Blazor WebAssembly

Calling Azure Functions from Blazor WebAssembly - ASP.NET Core Tutorial

From the course: Migrating ASP.NET Core Web Applications to Azure

Calling Azure Functions from Blazor WebAssembly

- [Instructor] We can now update the Blazor WebAssembly application to use that Azure Function or those Azure Functions. So we start in the Program.cs file where the HTTP client is configured and by default, the base address for HTTP calls is the current origin, the server where the Blazor application runs on. And we're changing that. So instead of that base address, we are using our Azure Functions URL. I just copied that to the clipboard. So let's put that in here. And then when calling the various endpoints, we just have to check whether the URIs in order. So what are we doing here? We are calling the sample data and then categories.json endpoint. And this has to be replaced with api/categories now. The same thing is true for the call in the product detail page. So we need the products, so api/products. And in the list of all products in one category, we also need to call the api/products endpoint. So let's…

Contents