Difference between mapping controller directly with app.MapControllers & in app.UseEndpoint method ?

I was trying to setup vue.js 3 with asp.net core api in the same project file. one of the problem i faced is whenever i use top level api routing it will get proxied to the SPA dev server. and will return the SPA app whenever requested. but if i actually mapped it inside the UseEndpoint method the proxy will ignore it and i can access the api without any problem. the compiler keep suggesting me to map with top level statement instead for some reason even tho the outcome is totally different. any ideas on why is this happening? is there anything am missing?
6 Replies
Pobiega
Pobiega2y ago
The nuget that contains UseProxyToSpaDevelopmentServer documentation explicitly mentions that you need to use UseEndpoints As for why this is different, can only guess that it's to do with default registered middleware
CaptainSh4dow
CaptainSh4dow2y ago
Thank you for the clarification. i have tried searching for the documentations for that nuget package but ended up with nothing for some reason.
Pobiega
Pobiega2y ago
I only know this because someone else asked about it ~2 days ago and linked their github
CaptainSh4dow
CaptainSh4dow2y ago
Understandable. thanks again.
Pobiega
Pobiega2y ago
yw, best of luck
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.