title: ASP.net Core React Template Route Attribute on Controller cannot prefix
body: <p>Using the dotnet cli I created a project based on the asp.net react template.
  Issues I do have with the controller class and customizing the <code>Route()</code> attribute on the class.</p>
  <p><strong>One important note: Routing with prefix does work, when using the asp.net webapi template, but does not work in the react teamplate.</strong></p>
  <p>This works just fine:</p>
  <pre><code>...
  [ApiController]
  [Route(&quot;[controller]&quot;)]
  public class TransactionController : ControllerBase
  { ...
  </code></pre>
  <p>Whenever I use something different to <code>[Route(&quot;[controller]&quot;)]</code> like</p>
  <p><code>[Route(&quot;api/[controller]&quot;)]</code> or even</p>
  <p><code>[Route(&quot;someBetterNaming&quot;)]</code>
  it doesnt work.</p>
  <p>Is there some other place I have to configure the routing?</p>
  <p>In the official tutorial there is nothing else mentioned.
  <a href="https://docs.microsoft.com/en-us/learn/modules/build-web-api-aspnet-core/" rel="nofollow noreferrer">Link</a></p>
  <p>TransactionController.cs</p>
  <pre><code>    using Microsoft.AspNetCore.Mvc;
      
      namespace asp_react.Controllers;
      
      [ApiController]
      [Route(&quot;[controller]&quot;)]  // working
      // [Route(&quot;api/[controller]&quot;)]  // not working
      public class TransactionController : ControllerBase
      {
          [HttpGet]
          public IActionResult GetTransaction()
          {
            return Ok(&quot;get success&quot;);
          }
      }
  </code></pre>
  <p>Programm.cs below</p>
  <pre><code>// Program.cs
  var builder = WebApplication.CreateBuilder(args);
      
  builder.Services.AddControllersWithViews();
  
  var app = builder.Build();
  
  if (!app.Environment.IsDevelopment())
  {
    app.UseHsts();
  }
  
  app.UseHttpsRedirection();
  app.UseStaticFiles();
  app.UseRouting();
  
  app.MapControllerRoute(
      name: &quot;default&quot;,
      pattern: &quot;{controller}/{action=Index}/{id?}&quot;);
  
  app.MapFallbackToFile(&quot;index.html&quot;); ;
  
  app.Run();
  </code></pre>
  <p>Still trying to familiarize with the file structure and learning to know which files are critical for configuring the project.</p>