The RouteBuilder class helps us to build custom routes and handle them on request arrival. The MVC also uses this class to build its default routing mechanism of the controller, actions.
In the last example, we created a basic route that serves on any route. Now we will create custom routes with different HTTP verbs like GET and POST.
Copy the following code in the Configure method of Startup.cs for custom route builder:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { var routes = new RouteBuilder(app) .MapGet("greeting", context => context.Response.WriteAsync("Good morning!! Packt readers.")) .MapGet("review/{msg}", context => context.Response.WriteAsync( $"This ...