Created
September 1, 2023 11:18
-
-
Save dj-nitehawk/bb78ba5dc07c1e20538c046ad7e154c2 to your computer and use it in GitHub Desktop.
Correct middleware order for UseSpa() from Microsoft.AspNetCore.SpaServices.Extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var builder = WebApplication.CreateBuilder(); | |
builder.Services.AddFastEndpoints(); | |
var app = builder.Build(); | |
app.UseRouting(); //should be before auth/cors/fastendpoints middlewares. | |
app.UseAuthorization(); | |
app.UseFastEndpoints(); | |
app.UseEndpoints(_ => { }); //should be right after UseFastEndpoints(). this is the terminating middleware for endpoint routes. | |
if (app.Environment.IsDevelopment()) | |
app.UseSpa(x => x.UseProxyToSpaDevelopmentServer("http://localhost:8001")); | |
app.Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment