Browse and test your LoopBack app's APIs
Go to file
Shelby Sanders 2c737d40b6 Merge remote-tracking branch 'upstream/master'
* upstream/master: (38 commits)
  Bump version
  res.send deprecated - updated to res.status
  Remove hidden properties from definition.
  Bump version
  Ensure models from relations are included
  1.2.4
  model-helper: handle arrays with undefined items
  1.2.3
  model-helper: handle array types with no item type
  Bump version
  Properly convert complex return types.
  Bump version
  Fix up loopback.rest() model definition hack.
  Bump version and update deps
  s/accessToken/access_token in authorization key name
  Fix resources if the explorer is at a deep path.
  Fix debug namespace, express version.
  Remove forgotten TODO.
  Simplify `accepts` and `returns` hacks.
  More consise type tests
  ...

Conflicts:
	public/css/loopbackStyles.css
	public/css/screen.css
	public/index.html
	public/lib/loadSwaggerUI.js
	public/lib/swagger.js
	public/swagger-ui.js
	public/swagger-ui.min.js
2014-08-04 18:11:36 -07:00
example Remove hidden properties from definition. 2014-07-26 12:15:47 -05:00
lib res.send deprecated - updated to res.status 2014-07-28 17:40:08 -05:00
public Merge remote-tracking branch 'upstream/master' 2014-08-04 18:11:36 -07:00
test Remove hidden properties from definition. 2014-07-26 12:15:47 -05:00
.gitignore Add indication of response being a collection 2014-07-09 03:36:41 -07:00
.jshintrc Refactoring swagger 1.2 rework. 2014-07-05 14:32:00 -05:00
LICENSE Update to dual MIT/StrongLoop license 2014-02-17 16:04:12 -08:00
LoopBackExplorer.iml Upgraded to latest Swagger-UI for 1.2 support 2014-07-12 23:04:13 -07:00
README.md Remove preMiddleware. 2014-07-10 14:16:10 -05:00
index.js Fix resources if the explorer is at a deep path. 2014-07-11 14:56:32 -04:00
package.json Bump version 2014-07-29 08:54:48 -07:00

README.md

loopback-explorer

Browse and test your LoopBack app's APIs.

Basic Usage

Below is a simple LoopBack application. The explorer is mounted at /explorer.

var loopback = require('loopback');
var app = loopback();
var explorer = require('../');
var port = 3000;

var Product = loopback.Model.extend('product');
Product.attachTo(loopback.memory());
app.model(Product);

app.use('/explorer', explorer(app, {basePath: '/api'}));
app.use('/api', loopback.rest());
console.log("Explorer mounted at localhost:" + port + "/explorer");

app.listen(port);

Advanced Usage

Many aspects of the explorer are configurable.

See options for a description of these options:

// Mount middleware before calling `explorer()` to add custom headers, auth, etc.
app.use('/explorer', loopback.basicAuth('user', 'password'));
app.use('/explorer', explorer(app, {
  basePath: '/custom-api-root',
  swaggerDistRoot: '/swagger',
  apiInfo: {
    'title': 'My API',
    'description': 'Explorer example app.'
  },
  resourcePath: 'swaggerResources',
  version: '0.1-unreleasable'
}));
app.use('/custom-api-root', loopback.rest());

Options

Options are passed to explorer(app, options).

basePath: String

Default: app.get('restAPIRoot') or '/api'.

Sets the API's base path. This must be set if you are mounting your api to a path different than '/api', e.g. with `loopback.use('/custom-api-root', loopback.rest());

swaggerDistRoot: String

Sets a path within your application for overriding Swagger UI files.

If present, will search swaggerDistRoot first when attempting to load Swagger UI, allowing you to pick and choose overrides to the interface. Use this to style your explorer or add additional functionality.

See index.html, where you may want to begin your overrides. The rest of the UI is provided by Swagger UI.

apiInfo: Object

Additional information about your API. See the spec.

resourcePath: String

Default: 'resources'

Sets a different path for the resource listing. You generally shouldn't have to change this.

version: String

Default: Read from package.json

Sets your API version. If not present, will read from your app's package.json.