npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sycle-express-explorer

v0.1.2

Published

Browse and test your Sycle app's APIs

Downloads

1

Readme

sycle-express-explorer

Browse and test your Sycle app's APIs.

Basic Usage

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

var sycle = require('sycle');
var express = require('express');
var rest = require('sycle-express-rest');
var explorer = require('../');
var port = 3000;

// create express application
var app = express();
app.disable('x-powered-by');

// create sycle application
var sapp = sycle();
sapp.registry.define('Product', {crud: true});
sapp.phase(sycle.boot.database());
sapp.boot(function (err) { if (err) throw err; });

// setup middlewares
var apiPath = '/api';
app.use('/explorer', explorer(sapp, { basePath: apiPath }));
app.use(apiPath, rest(sapp));
console.log("Explorer mounted at localhost:" + port + "/explorer");

// start server
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', basicAuth('user', 'password'));
app.use('/explorer', explorer(sapp, {
  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', rest(sapp));

Options

Options are passed to explorer(sapp, options).

basePath: String

Default: '/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 `app.use('/custom-api-root', rest(sapp));

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.

Field Name | Type | Description ---|:---:|--- title | string | Required. The title of the application. description | string | Required. A short description of the application. termsOfServiceUrl | string | A URL to the Terms of Service of the API. contact | string | An email to be used for API-related correspondence. license | string | The license name used for the API. licenseUrl | string | A URL to the license used for the API.

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.