Files
vegasco/src/Vegasco.Server.AppHost/Program.cs

34 lines
945 B
C#
Raw Normal View History

using Microsoft.Extensions.Hosting;
using Vegasco.Server.AppHost.Shared;
IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(args);
IResourceBuilder<PostgresServerResource> postgresBuilder = builder.AddPostgres(Constants.Database.ServiceName)
2025-06-12 19:12:26 +02:00
.WithLifetime(ContainerLifetime.Persistent)
.WithDataVolume();
if (builder.Environment.IsDevelopment())
{
postgresBuilder = postgresBuilder
.WithPgWeb()
.WithPgAdmin();
}
IResourceBuilder<PostgresDatabaseResource> postgres = postgresBuilder
.AddDatabase(Constants.Database.Name);
2025-06-13 20:12:43 +02:00
IResourceBuilder<ProjectResource> api = builder
.AddProject<Projects.Vegasco_Server_Api>(Constants.Projects.Api)
.WithReference(postgres)
.WaitFor(postgres);
2025-06-13 20:12:43 +02:00
builder
.AddNpmApp("Vegasco-Web", "../Vegasco-Web")
2025-06-13 20:12:43 +02:00
.WithReference(api)
.WaitFor(api)
2025-06-29 12:02:11 +02:00
.WithHttpEndpoint(port: 44200, env: "PORT")
.WithExternalHttpEndpoints()
.WithHttpHealthCheck("/", 200);
2025-06-13 20:12:43 +02:00
builder.Build().Run();