File: AppHost.cs
Web Access
Project: src\playground\AspireWithNode\AspireWithNode.AppHost\AspireWithNode.AppHost.csproj (AspireWithNode.AppHost)
using Microsoft.Extensions.Hosting;
 
var builder = DistributedApplication.CreateBuilder(args);
 
var cache = builder.AddRedis("cache");
 
var weatherapi = builder.AddProject<Projects.AspireWithNode_AspNetCoreApi>("weatherapi");
 
var frontend = builder.AddNpmApp("frontend", "../NodeFrontend", "watch")
    .WithReference(weatherapi)
    .WaitFor(weatherapi)
    .WithReference(cache)
    .WaitFor(cache)
    .WithHttpEndpoint(env: "PORT")
    .WithExternalHttpEndpoints()
    .PublishAsDockerFile();
 
var launchProfile = builder.Configuration["DOTNET_LAUNCH_PROFILE"];
 
if (builder.Environment.IsDevelopment() && launchProfile == "https")
{
    frontend.RunWithHttpsDevCertificate("HTTPS_CERT_FILE", "HTTPS_CERT_KEY_FILE");
}
 
builder.Build().Run();