concept MVC Core in category .net

This is an excerpt from Manning's book Microservices in .NET Core, Second Edition.
In this chapter, I’ll explain what microservices are and demonstrate why they’re interesting. We’ll also look at the six characteristics of a microservice. Finally, I’ll introduce you to the most important technologies we’ll use in this book: .NET Core and MVC Core.
Listing 1.1. Startup with MVC
language="cs" linenumbering="unnumbered">namespace HelloMicroservices { using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddControllers(); #1 } public void Configure( IApplicationBuilder app, IWebHostEnvironment env) { app.UseHttpsRedirection(); #2 app.UseRouting(); app.UseEndpoints(endpoints => endpoints.MapControllers()); #3 } } }Apart from adding controller and helpers to the services collection and adding our endpoints to routing table we also added a line that redirects all HTTP requests to HTTPS. Our application will handle HTTPS requests on port 5001. For example s request to http://localhost:5000/ will be redirected to https://localhost:5001/. The first time you attempt to make a request to https://localhost:5001/ you will probably be warned about an unknown certificate. This is a development certificate that your microservices will use localhost and you can safely accept the certificate.