API Description Request body Response body GET /api/todo Get all to-do items None Array of to-do items GET /api/todo/{id} Get an item by ID None To-do item POST /api/todo Add a new item To-do item To-do item PUT /api/todo/{id} Update an existing item…
Hosting -------------------------------------------------------------------------- Setting up a Host : using Microsoft.AspNetCore.Hosting; public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .…
Dependency Injection ------------------------------------------------------------------------ ASP.NET services can be configured with the following lifetimes: Transient Transient lifetime services are created each time they are requested. This lifeti…
Configuration var builder = new ConfigurationBuilder(); builder.AddInMemoryCollection(); var config = builder.Build(); config["somekey"] = "somevalue"; // do some other work var setting = config["somekey"]; // also returns &q…
Logging --------------------------------------------------------------------------------------- Implementing Logging in your Application var logger = loggerFactory.CreateLogger("Catchall Endpoint"); logger.LogInformation("No endpoint found…
Globalization and localization **************************************************************************************************** using Microsoft.AspNet.Localization; using Microsoft.AspNet.Mvc.Localization; namespace Localization.StarterWeb.Contro…