I am using Asp.net 6 web API in my project and I am confused about understanding routing functions. Previously when we build API we use to use following middleware
app.UseRouting()
...Other middleware
app.UseEndPoints()
But now in Asp.Net 6 the default way to use this
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers()
No need to use app.UseRouting() and app.UseEndPoints() rather use directly app.MapControllers() after other middlwares
I wonder what app.MapControllers() does internally? Does it mean that all routes are authorized by defualt?
How to use other middleware before registering routes? I am kind of confused to understand between these approaches
app.UseRouting() VS app.UseEndpoints() VS app.MapControllers();