whook-swagger-ui
v0.0.0
Published
An `httpRouter` wrapper to provider SwaggerUI for local dev
Downloads
3
Readme
whook-swagger-ui
An
httpRouter
wrapper to provider SwaggerUI for local dev
To use it, just wrap the HTTP router with this module and
register it again with the Knifecycle
instance inside the
runServer
function:
import Knifecycle from 'knifecycle';
import {
runServer as runBaseServer,
prepareServer as prepareBaseServer,
} from 'whook';
import { initHTTPRouter } from 'swagger-http-router';
import wrapHTTPRouterWithSwaggerUI from 'whook-swagger-ui';
// It is important to do this in the runServer function since it really
// make sense only when actually running the server
export async function runServer(injectedNames = [], $ = new Knifecycle()) {
$.register(
wrapHTTPRouterWithSwaggerUI(initHTTPRouter),
);
return await runBaseServer(injectedNames, $);
}
export const prepareServer = prepareBaseServer;
API
wrapHTTPRouterWithSwaggerUI(initHTTPRouter) ⇒ function
Wraps the httpRouter
initializer to also serve the
Swagger/OpenAPI UI for development purpose.
Kind: global function
Returns: function - The httpRouter
initializer wrapped
| Param | Type | Description |
| --- | --- | --- |
| initHTTPRouter | function | The httpRouter
initializer |