Fix broken indentation

Partially revert 298765547
This commit is contained in:
Miroslav Bajtoš 2016-04-29 15:36:44 +02:00
parent fabc7cf5fb
commit 67f48d5dcb
1 changed files with 72 additions and 72 deletions

View File

@ -2,17 +2,17 @@
/*! /*!
* Adds dynamically-updated docs as /explorer * Adds dynamically-updated docs as /explorer
*/ */
var url = require('url'); var url = require('url');
var path = require('path'); var path = require('path');
var urlJoin = require('./lib/url-join'); var urlJoin = require('./lib/url-join');
var _defaults = require('lodash').defaults; var _defaults = require('lodash').defaults;
var cors = require('cors'); var cors = require('cors');
var createSwaggerObject = require('loopback-swagger').generateSwaggerSpec; var createSwaggerObject = require('loopback-swagger').generateSwaggerSpec;
var SWAGGER_UI_ROOT = require('strong-swagger-ui/index').dist; var SWAGGER_UI_ROOT = require('strong-swagger-ui/index').dist;
var STATIC_ROOT = path.join(__dirname, 'public'); var STATIC_ROOT = path.join(__dirname, 'public');
module.exports = explorer; module.exports = explorer;
explorer.routes = routes; explorer.routes = routes;
/** /**
* Example usage: * Example usage:
@ -21,13 +21,13 @@
* explorer(app, options); * explorer(app, options);
*/ */
function explorer(loopbackApplication, options) { function explorer(loopbackApplication, options) {
options = _defaults({}, options, { mountPath: '/explorer' }); options = _defaults({}, options, { mountPath: '/explorer' });
loopbackApplication.use(options.mountPath, routes(loopbackApplication, options)); loopbackApplication.use(options.mountPath, routes(loopbackApplication, options));
loopbackApplication.set('loopback-component-explorer', options); loopbackApplication.set('loopback-component-explorer', options);
} }
function routes(loopbackApplication, options) { function routes(loopbackApplication, options) {
var loopback = loopbackApplication.loopback; var loopback = loopbackApplication.loopback;
var loopbackMajor = loopback && loopback.version && var loopbackMajor = loopback && loopback.version &&
loopback.version.split('.')[0] || 1; loopback.version.split('.')[0] || 1;
@ -84,7 +84,7 @@
} }
return router; return router;
} }
/** /**
* Setup Swagger documentation on the given express app. * Setup Swagger documentation on the given express app.
@ -95,7 +95,7 @@
* swagger documentation. * swagger documentation.
* @param {Object} opts Options. * @param {Object} opts Options.
*/ */
function mountSwagger(loopbackApplication, swaggerApp, opts) { function mountSwagger(loopbackApplication, swaggerApp, opts) {
var swaggerObject = createSwaggerObject(loopbackApplication, opts); var swaggerObject = createSwaggerObject(loopbackApplication, opts);
// listening to modelRemoted event for updating the swaggerObject // listening to modelRemoted event for updating the swaggerObject
@ -113,12 +113,12 @@
swaggerApp.get(resourcePath, function sendSwaggerObject(req, res) { swaggerApp.get(resourcePath, function sendSwaggerObject(req, res) {
res.status(200).send(swaggerObject); res.status(200).send(swaggerObject);
}); });
} }
function setupCors(swaggerApp, remotes) { function setupCors(swaggerApp, remotes) {
var corsOptions = remotes.options && remotes.options.cors || var corsOptions = remotes.options && remotes.options.cors ||
{ origin: true, credentials: true }; { origin: true, credentials: true };
// TODO(bajtos) Skip CORS when remotes.options.cors === false // TODO(bajtos) Skip CORS when remotes.options.cors === false
swaggerApp.use(cors(corsOptions)); swaggerApp.use(cors(corsOptions));
} }