@@ -21,11 +21,14 @@ const htmlOrError = specFile => {
2121 }
2222}
2323
24- const launchServer = ( app , port , specFile ) => {
24+ const launchServer = ( app , port , specFile , { verbose } ) => {
2525 app . listen ( port , ( ) => {
26- console . log ( `API docs server running on http://localhost:${ port } !` ) ;
27- } )
28- . on ( 'error' , e => {
26+ if ( verbose > 0 ) {
27+ console . log ( `API specifications server running!` ) ;
28+ console . log ( `HTML: http://localhost:${ port } ` ) ;
29+ console . log ( `JSON Specs: http://localhost:${ port } /spec.json` ) ;
30+ }
31+ } ) . on ( 'error' , e => {
2932 console . error ( 'Failed to start server: ' + e . message ) ;
3033 process . exit ( 1 ) ;
3134 } ) ;
@@ -48,13 +51,14 @@ const command = async (specFile, cmd) => {
4851
4952 app . use ( '/assets/redoc' , express . static ( bundleDir ) ) ;
5053 app . get ( '/spec.json' , ( req , res ) => {
54+ res . header ( 'content-type' , 'application/vnd.oai.openapi+json' ) ;
5155 res . send ( JSON . stringify ( spec ) ) ;
5256 } ) ;
5357 app . get ( '/' , ( req , res ) => {
5458 res . send ( html ) ;
5559 } ) ;
5660
57- launchServer ( app , port , specFile ) ;
61+ launchServer ( app , port , specFile , { verbose } ) ;
5862}
5963
6064const buildLoaderOptions = ( jsonSchema , verbose ) => {
0 commit comments