title: How to add global route prefix in asp.net core 6
body: <p>Unfortunately, advices for previous versions didn't work
  <a href="https://stackoverflow.com/questions/58340979/how-to-add-global-route-prefix-in-asp-net-core-3">How to add global route prefix in asp.net core 3?</a></p>
  <pre><code>app.UsePathBase(new PathString(&quot;/api&quot;));
  </code></pre>
  <p>nor this one</p>
  <pre><code>public static class MvcOptionsExtensions
  {
      public static void UseGeneralRoutePrefix(this MvcOptions opts, IRouteTemplateProvider routeAttribute)
      {
          opts.Conventions.Add(new RoutePrefixConvention(routeAttribute));
      }
  
      public static void UseGeneralRoutePrefix(this MvcOptions opts, string 
      prefix)
      {
          opts.UseGeneralRoutePrefix(new RouteAttribute(prefix));
      }
  }
  </code></pre>