We are evaluating ServiceStack for a new internal project. We are using the template https://github.com/NetCoreTemplates/web but when we run the app the app is not redirecting automatically to the metadata page like it seems the behavior from the doc but open the browser to http://localhost:5001
Can someone help us?
Thanks
CodePudding user response:
The web template loads the wwwroot/index.html
home page which shows an example of calling ServiceStack APIs from a web page with Vanilla JS as well as links to call your APIs from the built-in API Explorer.
If you prefer to redirect to the /metadata
page on Startup you can either configure it in your ServiceStack AppHost:
SetConfig(new HostConfig {
DefaultRedirectPath = "/metadata"
});
Alternatively if you delete the wwwroot/index.html
homepage you can use an ASP.NET Core middleware to configure a fallback route in Program.cs
app.UseServiceStack(new AppHost());
app.Run(async context => context.Response.Redirect("/metadata"));
Which wil redirect unhandled routes to the /metadata
page.