Reputation: 1708
I am using ServiceStack for my custom service, in stand alone mode without IIS.
I would like to add documentation for my services beyond what /metadata
does. I thought to try the Swagger plug in.
I have added the plug-in command to my Config
public override void Configure(Funq.Container container)
{
SetConfig(new EndpointHostConfig()
{
DefaultRedirectPath = "index.html",
DebugMode = true,
WriteErrorsToResponse = true,
CustomHttpHandlers =
{
{ HttpStatusCode.Unauthorized, new AuthorizationErrorHandler() },
{ HttpStatusCode.Forbidden, new AuthorizationErrorHandler() },
{ HttpStatusCode.NotFound, new AuthorizationErrorHandler() }
}
});
// For automatic generation of documentation to APIs
Plugins.Add(new SwaggerFeature());
}
The existing services continue to work, but attempting to access
/swagger-ui/index.html
gives the not found error. Is there an additional step not clearly documented at
https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API
Do I have to actually set up this page myself? If so, how?
Upvotes: 2
Views: 2799
Reputation: 143399
Adding the ServiceStack.Api.Swagger NuGet package should include all the client side resources you need. Try updating the NuGet package as all the client side resources you need should already be in /swagger-ui
Upvotes: 1
Reputation: 1708
After more research, using the servicestack.api.swagger
package only installs the /resource service to query the API. It does not include any client-side resources.
To get the client-side UI, you have to download the files from the Swagger UI project on Github, and install the dist
directory resources yourself.
Upvotes: 1