Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sauce-api/visualizer-ui

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sauce-api/visualizer-ui

A Swagger UI esque visualizer for Sauce API

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

A Swagger UI esque visualizer for Sauce API

Usage

Consuming in Sauce API would look similar to:

    import { visualizerUI, setupVisualizerUI } from "@sauce-api/visualizer-ui";

    setupVisualizerUI(this.app);
    this.app.get("/docs", async (req, res, next)=>{
        const appRoutes = await new Routes(sauceConfig)
        .getFormattedRoutes(true);

        const ui = await visualizerUI({
            appRoutes,
            appName: "Visualizer",
            apiBaseUrl: process.env.REACT_APP_BASE_URL,
            apiHealthcheckPath: process.env.REACT_APP_DOCS_HEALTHCHECK_ENDPOINT,
            defaultTheme: "dark",
            brandIcon: "bullseye",
            brandImageUrl: "https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg"
        });
        res.send(ui);
    });

Options

Visualizer config

Example

     import { VisualizerConfig } from "./@types/VisualizerConfig";

    const visualizerConfig = {
        appRoutes: [],
        appName: "Visualizer",
        apiBaseUrl: process.env.REACT_APP_BASE_URL,
        apiHealthcheckPath: process.env.REACT_APP_DOCS_HEALTHCHECK_ENDPOINT,
        defaultTheme: "dark",
        brandIcon: "bullseye",
        brandImageUrl: "https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg"
    };
Config PropertyDescription
appRoutesAn Array of formatted Sauce API route objects. See Sauce API for details on formatted routes
appNameThe App name that will be displayed in the docs UI
apiBaseUrlThe base URL for the API you're displaying docs for. Ex: https://<some-sauce-api>.com
apiHealthcheckPathIf you have a healthcheck endpoint, you can supply it here and the UI will do a healthcheck for you. This value will be appended to the apiBaseUrl. Example: /healthcheck
defaultThemeThe default theme to display
brandIconYou can supply a (free) font-awesome icon name here to display in the upper left corner.
brandImageUrlThis is an alternative to the brandIcon value. You can supply your own image here to be displayed in the upper left corner

Supported Route Icons

IconRequirements
Admin ShieldExpects a route to have a policy named isAdmin
Authentication LockExpects a route to have a policy named isAuthenticated

Development

(Requires Docker)

Running

Run make run and the app will come up on http://localhost:3001

Bundling

Run make package

Getting Started with Create React App

This project was bootstrapped with Create React App.

Keywords

FAQs

Package last updated on 06 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc