frankcollins3 / ASPokedex

Pokedex with ASP backend / razor pages, and VanillaJS front end
1 stars 0 forks source link

"top level route registrations instead of UseEndpoints" [8:25am] #25

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

attempting to do: run app and check SwaggerUI for API endpoints.

error: /pokeapi/Program.cs(50,5): warning ASP0014: Suggest using top level route registrations instead of UseEndpoints (https://aka.ms/aspnet/analyzers)

here's the line of code the compiler is contending with: Screen Shot 2023-09-26 at 8 25 35 AM

proposed approach: // sidenote: this code took a long time to get correct in ASP/razor-pages & is the code I thought would need a fix for webapi. problem last time was only using chatGPT when stack overflow and code on github fixed the problem in 30 minutes.

possible improvements:

frankcollins3 commented 1 year ago

app.MapControllers();

👍 app.MapControllerRoute( // Move the route configuration here name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); [8:32am]