lib/file-server.js
function serveDereferencedSwaggerFile (req, res, next) {
    if (req.method === "GET" || req.method === "HEAD") {
      let configPath = getConfiguredPath(options.apiPath);
      configPath = util.normalizePath(configPath, router);
      let reqPath = util.normalizePath(req.path, router);

      if (reqPath === configPath) {
        if (context.api) {
          util.debug("%s %s => Sending the Swagger API as JSON", req.method, req.path);
          res.json(context.api);
        }
        else {
          util.warn("WARNING! The Swagger API is empty. Sending an HTTP 500 response to %s %s", req.method, req.path);
          res.status(500).json({});
        }
        return;
      }
    }

    next();
  }
function serveDereferencedSwaggerFile (req, res, next) {
    if (req.method === "GET" || req.method === "HEAD") {
      let configPath = getConfiguredPath(options.apiPath);
      configPath = util.normalizePath(configPath, router);
      let reqPath = util.normalizePath(req.path, router);

      if (reqPath === configPath) {
        if (context.api) {
          util.debug("%s %s => Sending the Swagger API as JSON", req.method, req.path);
          res.json(context.api);
        }
        else {
          util.warn("WARNING! The Swagger API is empty. Sending an HTTP 500 response to %s %s", req.method, req.path);
          res.status(500).json({});
        }
        return;
      }
    }

    next();
  }
function serveDereferencedSwaggerFile ( req , res , next ) { if ( req . method === "GET" || req . method === "HEAD" ) { let configPath = getConfiguredPath ( options . apiPath ) ; configPath = util . normalizePath ( configPath , router ) ; let reqPath = util . normalizePath ( req . path , router ) ; if ( reqPath === configPath ) { if ( context . api ) { util . debug ( "%s %s => Sending the Swagger API as JSON" , req . method , req . path ) ; res . json ( context . api ) ; } else { util . warn ( "WARNING! The Swagger API is empty. Sending an HTTP 500 response to %s %s" , req . method , req . path ) ; res . status ( 500 ) . json ( { } ) ; } return ; } } next ( ) ; }
Serves the fully-dereferenced Swagger API in JSON format.
Serves the fully - dereferenced Swagger API in JSON format .