This module contains a component adding a Context Explorer to LoopBack applications.
Experimental packages provide early access to advanced or experimental functionality to get community feedback. Such modules are published to npm using
0.x.y
versions. Their APIs and functionality may be subject to breaking changes in future releases.
npm install --save @loopback/context-explorer
The component should be loaded in the constructor of your custom Application class.
Start by importing the component class:
import {ContextExplorerComponent} from '@loopback/context-explorer';
In the constructor, add the component to your application:
this.component(ContextExplorerComponent);
By default, API Explorer is mounted at /context-explorer
. This path can be
customized via ContextExplorer configuration as follows:
this.configure(ContextExplorerBindings.COMPONENT).to({
path: '/context-ui',
});
The following endpoints are added by the component.
-
/context-explorer/inspect
: Fetch a JSON document for the context hierarchy.The following query parameters are supported:
- includeParent: include parent contexts (default:
true
) - includeInjections: include injections (default:
true
) - includeGraph: include a graph in graphviz dot
format (default:
true
)
- includeParent: include parent contexts (default:
-
/context-explorer/graph
: Render the LoopBack application as a SVG diagram.The following query parameters are supported:
- includeParent: include parent contexts (default:
true
) - includeInjections: include injections (default:
true
) - format:
dot
orsvg
(default:svg
)
- includeParent: include parent contexts (default:
-
/context-explorer
: Display the graph using d3-graphviz.
Run npm test
from the root folder.
See all contributors.
MIT