Implement US-01 patient profile creation and retrieval

This commit is contained in:
Steffen committed 2026-09-30 22:34:44 +02:00
1 parent d6f79a91c0
commit eb2cf2e54a
30 files changed
+792

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
namespace ApiGateway;
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddProblemDetails();
builder.Services.AddHttpClient("PatientProfile", (services, client) =>
client.BaseAddress = GetBaseUri(services.GetRequiredService<IConfiguration>()))
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false });
var app = builder.Build();
_ = GetBaseUri(app.Configuration);
app.UseExceptionHandler();
app.MapControllers();
app.Run();
}
private static Uri GetBaseUri(IConfiguration configuration)
{
var endpoint = configuration["Services:PatientProfile:BaseUrl"];
if (!Uri.TryCreate(endpoint, UriKind.Absolute, out var baseUri) ||
(baseUri.Scheme != "http" && baseUri.Scheme != "https") ||
baseUri.AbsolutePath != "/" || !string.IsNullOrEmpty(baseUri.Query) ||
!string.IsNullOrEmpty(baseUri.Fragment) || !string.IsNullOrEmpty(baseUri.UserInfo))
throw new InvalidOperationException("Services:PatientProfile:BaseUrl must be an HTTP(S) origin URL.");
return baseUri;
}
}