October 2018
Beginner to intermediate
478 pages
10h 8m
English
In SPAs, the complexity needed from ASP.NET Core MVC routing is low, because routing will mostly be taken care of by the frontend code. On the ASP.NET Core MVC end, we will use routing to support client-side routing capabilities.
For this, we will take advantage of conventional routing and set up two catch-all routes, as follows:
app.UseMvc(routes =>{ routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new { controller = "Home", action = "Index" });});
The first default route was discussed earlier in this section. This will enable all incoming requests to be directed to the Index method of the HomeController.
The second route uses ...
Read now
Unlock full access