Skip to content

Instantly share code, notes, and snippets.

@sainture
Last active March 27, 2019 03:56
Show Gist options
  • Select an option

  • Save sainture/9aa3c3bf1f0e0bc7be09cc5fd934f3bc to your computer and use it in GitHub Desktop.

Select an option

Save sainture/9aa3c3bf1f0e0bc7be09cc5fd934f3bc to your computer and use it in GitHub Desktop.
// The ASP.NET Core architecture features a system of middleware, which are pieces of code that handle requests and responses. Middleware are chained to each other to form a pipeline
// Incoming requests are passed through the pipeline, where each middleware has a chance to do something with them before passing them to the next middleware. Outgoing responses are also passed through the pipeline, in reverse order.
// (ex: MVC is a middleware, Auth is a middleware, serve static files is also a middleware)
// ConfigureServices method of Startup class
// add MVC middleware
services.AddMVC()
// to add a default route along with MVC middleware
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Conference}/{action=Index}/{id?}");
});
// static files middleware
app.UseStaticFiles();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment