Merge pull request #234 from strongloop/fix-link2
docs: update docs link away from docs.strongloop.com
This commit is contained in:
commit
efd2a16bce
30
index.js
30
index.js
|
@ -34,18 +34,25 @@ explorer.routes = routes;
|
||||||
|
|
||||||
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.version.split('.')[0] || 1;
|
(loopback && loopback.version && loopback.version.split('.')[0]) || 1;
|
||||||
|
|
||||||
if (loopbackMajor < 2) {
|
if (loopbackMajor < 2) {
|
||||||
throw new Error(g.f('{{loopback-component-explorer}} requires ' +
|
throw new Error(
|
||||||
'{{loopback}} 2.0 or newer'));
|
g.f(
|
||||||
|
'{{loopback-component-explorer}} requires ' +
|
||||||
|
'{{loopback}} 2.0 or newer'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
options = _defaults({}, options, {
|
options = _defaults({}, options, {
|
||||||
|
@ -129,7 +136,7 @@ function mountSwagger(loopbackApplication, swaggerApp, opts) {
|
||||||
swaggerObject = createSwaggerObject(loopbackApplication, opts);
|
swaggerObject = createSwaggerObject(loopbackApplication, opts);
|
||||||
});
|
});
|
||||||
|
|
||||||
var resourcePath = opts && opts.resourcePath || 'swagger.json';
|
var resourcePath = (opts && opts.resourcePath) || 'swagger.json';
|
||||||
if (resourcePath[0] !== '/') resourcePath = '/' + resourcePath;
|
if (resourcePath[0] !== '/') resourcePath = '/' + resourcePath;
|
||||||
|
|
||||||
var remotes = loopbackApplication.remotes();
|
var remotes = loopbackApplication.remotes();
|
||||||
|
@ -142,14 +149,15 @@ function mountSwagger(loopbackApplication, swaggerApp, opts) {
|
||||||
|
|
||||||
function setupCors(swaggerApp, remotes) {
|
function setupCors(swaggerApp, remotes) {
|
||||||
var corsOptions = remotes.options && remotes.options.cors;
|
var corsOptions = remotes.options && remotes.options.cors;
|
||||||
if (corsOptions === false)
|
if (corsOptions === false) return;
|
||||||
return;
|
|
||||||
|
|
||||||
deprecated(g.f(
|
deprecated(
|
||||||
|
g.f(
|
||||||
'The built-in CORS middleware provided by loopback-component-explorer ' +
|
'The built-in CORS middleware provided by loopback-component-explorer ' +
|
||||||
'was deprecated. See %s for more details.',
|
'was deprecated. See %s for more details.',
|
||||||
'https://docs.strongloop.com/display/public/LB/Security+considerations'
|
'https://loopback.io/doc/en/lb3/Security-considerations.html'
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (corsOptions === undefined) {
|
if (corsOptions === undefined) {
|
||||||
corsOptions = { origin: true, credentials: true };
|
corsOptions = { origin: true, credentials: true };
|
||||||
|
|
Loading…
Reference in New Issue