title: ASP.NET Core Route not working
body: <p>The Routers are configured this way:</p>
  
  <pre><code>app.UseMvc(routes =&gt;
  {
      routes.MapRoute(
          name: "api",
          template: "api/{action}/{id?}");
  });
  
  app.UseMvc(routes =&gt;
  {
      routes.MapRoute(
          name: "spa-fallback",
          template: "{*url}",
          defaults: new { controller = "Home", action = "Index"});
  });
  </code></pre>
  
  <p>The controller I action I am trying to request looks like this:
  // GET api/values/5</p>
  
  <pre><code>[HttpGet("{id}")]
  public string Get(int id)
  {
      return "value" + id;
  }
  </code></pre>
  
  <p>When I request <a href="http://localhost:54057/api/values/get" rel="noreferrer">http://localhost:54057/api/values/get</a>, I get back "value0".</p>
  
  <p>When I request <a href="http://localhost:54057/api/values/get" rel="noreferrer">http://localhost:54057/api/values/get</a>, I get back "value0".</p>
  
  <p>When I request <a href="http://localhost:54057/api/values/get/5" rel="noreferrer">http://localhost:54057/api/values/get/5</a>, I get back a 404 Not Found.</p>
  
  <p>Are my routes configured incorrectly, or why is that that the "id" parameter is not passed from the URL to the controller action?</p>