Add Azure function app project with test function
This commit is contained in:
23
BeauFindlay/src/BeauFindlay.Client/Pages/Contact.razor
Normal file
23
BeauFindlay/src/BeauFindlay.Client/Pages/Contact.razor
Normal file
@@ -0,0 +1,23 @@
|
||||
@page "/contact"
|
||||
|
||||
@inject HttpClient HttpClient
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(apiResponse))
|
||||
{
|
||||
<p class="text-2xl">Response from Azure Function API: @apiResponse</p>
|
||||
}
|
||||
|
||||
@code {
|
||||
private string apiResponse = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var response = await HttpClient.GetStringAsync("/api/Function1");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(response))
|
||||
{
|
||||
apiResponse = response;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,8 +7,11 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
var apiBase = builder.Configuration["ApiBase"]
|
||||
?? throw new ArgumentException("API base address not found in config.");
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(apiBase) });
|
||||
|
||||
builder.Services.AddSingleton<ITypewriterNotificationService, TypewriterNotificationService>();
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
await builder.Build().RunAsync();
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"navigationFallback": {
|
||||
"rewrite": "/index.html"
|
||||
}
|
||||
}
|
||||
10
BeauFindlay/src/BeauFindlay.Client/wwwroot/appsettings.json
Normal file
10
BeauFindlay/src/BeauFindlay.Client/wwwroot/appsettings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ApiBase": "http://localhost:7071"
|
||||
}
|
||||
Reference in New Issue
Block a user