1

I"m using swagger-net. By default, the swagger UI will be "/swagger", how do I change it to root?

Feel like what I'm doing now is a hack

public class HomeController : Controller
{
    public ActionResult Index()
    {
        return Redirect("/swagger");
        //return View();
    }
}
JeeShen Lee
  • 3,476
  • 5
  • 39
  • 59

1 Answers1

0

Found a solution. Added the below route mapping to WebApiConfig.cs

config.Routes.MapHttpRoute(
    name: "Swagger UI",
    routeTemplate: "",
    defaults: null,
    constraints: null,
    handler: new RedirectHandler(SwaggerDocsConfig.DefaultRootUrlResolver, "swagger/ui/index"));
JeeShen Lee
  • 3,476
  • 5
  • 39
  • 59