Skip to content

Commit 102273f

Browse files
committed
redirect to client app on /
1 parent 817072b commit 102273f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

MyApp/Configure.AppHost.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ public void Configure(IWebHostBuilder builder) => builder
1212
// Configure ASP.NET Core IOC Dependencies
1313
services.AddSingleton(new AppConfig {
1414
AppBaseUrl = context.HostingEnvironment.IsDevelopment()
15-
? "https://localhost" +
16-
":3000" +
17-
""
15+
? "https://localhost:3000"
1816
: null,
1917
ApiBaseUrl = context.HostingEnvironment.IsDevelopment()
2018
? "https://localhost:5001"
@@ -26,7 +24,6 @@ public void Configure(IWebHostBuilder builder) => builder
2624
public override void Configure()
2725
{
2826
TypeScriptGenerator.InsertTsNoCheck = true;
29-
3027
SetConfig(new HostConfig {
3128
});
3229
}

MyApp/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
ctx.Response.StatusCode = 404;
7979
}
8080
});
81+
// Redirect root requests to the Client App in development
82+
app.MapGet("/", async (HttpContext ctx) =>
83+
ctx.Response.Redirect(ctx.RequestServices.GetRequiredService<AppConfig>().AppBaseUrl!));
8184
}
8285
else
8386
{

0 commit comments

Comments
 (0)