A tutorial on using @loopback/rest-explorer to add a self-hosted REST API ExplorerNote: This page was generated from the loopback-next/packages/rest-explorer/README.md.

@loopback/rest-explorer

This module contains a component adding a self-hosted REST API Explorer toLoopBack applications.

Installation

  1. npm install --save @loopback/rest-explorer

Basic use

The component should be loaded in the constructor of your custom Applicationclass. Applications scaffolded by recent versions of our lb4 CLI tool have theself-hosted REST API Explorer pre-configured out of the box.

Start by importing the component class:

  1. import {RestExplorerComponent} from '@loopback/rest-explorer';

In the constructor, add the component to your application:

  1. this.component(RestExplorerComponent);

By default, API Explorer is mounted at /explorer. This path can be customizedvia RestExplorer configuration as follows:

  1. this.configure(RestExplorerBindings.COMPONENT).to({
  2. path: '/openapi/ui',
  3. });

Or:

  1. this.bind(RestExplorerBindings.CONFIG).to({
  2. path: '/openapi/ui',
  3. });

NOTE: The Explorer UI’s visual style is not customizable yet. Our recommendedsolution is to create a fork of this module, make any style changes in the forkand publish the modified module under a different name. TheGitHub issue #2023 isrequesting a configuration option for customizing the visual style, pleaseup-vote the issue and/or join the discussion if you are interested in thisfeature.

Contributions

Tests

Run npm test from the root folder.

Contributors

Seeall contributors.

License

MIT