All Projects → bukalapak → Snowboard

bukalapak / Snowboard

Licence: mit
API blueprint toolkit

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Snowboard

Moneykeeper
💰A lightweight billing tool.
Stars: ✭ 584 (-19.23%)
Mutual labels:  app
Workbench
Seamless, automatic, “dotfile” sync to iCloud.
Stars: ✭ 650 (-10.1%)
Mutual labels:  app
Gankdaily
A application used to show technical information in every working days, use MVP pattern.
Stars: ✭ 704 (-2.63%)
Mutual labels:  app
Eul
🖥️ macOS status monitoring app written in SwiftUI.
Stars: ✭ 6,707 (+827.66%)
Mutual labels:  app
App Framework
Applications for any device with HTML, CSS and JavaScript - free and open source!
Stars: ✭ 639 (-11.62%)
Mutual labels:  app
Tinder React Native
Tinder clone - React Native.
Stars: ✭ 661 (-8.58%)
Mutual labels:  app
Textor
A plain text editor for iOS
Stars: ✭ 564 (-21.99%)
Mutual labels:  app
Spirit
🙌 Play Spirit animations on the web
Stars: ✭ 719 (-0.55%)
Mutual labels:  app
Jspaint
🎨 Classic MS Paint, REVIVED + ✨Extras
Stars: ✭ 5,972 (+726%)
Mutual labels:  app
Acme bank
An example ☂ project
Stars: ✭ 700 (-3.18%)
Mutual labels:  app
React Native Redux Feinn
🚀 react native redux FeInn 从零到1让你学会搭建一个APP
Stars: ✭ 609 (-15.77%)
Mutual labels:  app
Emission
⚠️ Deprecated repo, moved to artsy/eigen ➡️ React Native Components
Stars: ✭ 620 (-14.25%)
Mutual labels:  app
Devdocs
API Documentation Browser
Stars: ✭ 27,208 (+3663.21%)
Mutual labels:  app
Tensorflowandroiddemo
TensorFlow android demo 车道线 车辆 人脸 动作 骨架 识别 检测 抽烟 打电话 闭眼 睁眼
Stars: ✭ 589 (-18.53%)
Mutual labels:  app
Caprine
Elegant Facebook Messenger desktop app
Stars: ✭ 6,170 (+753.39%)
Mutual labels:  app
Alerter
An Android Alerting Library
Stars: ✭ 5,213 (+621.02%)
Mutual labels:  app
Latest
A small utility app for macOS that makes sure you know about all the latest updates to the apps you use.
Stars: ✭ 657 (-9.13%)
Mutual labels:  app
Piral
Framework for next generation web apps using microfrontends. 🚀
Stars: ✭ 711 (-1.66%)
Mutual labels:  app
Marknote
📑MarkNote: An open sourced markdown note-taking application for Android, support many features for markdown notes, mathjax, table, list etc.
Stars: ✭ 717 (-0.83%)
Mutual labels:  app
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+3887%)
Mutual labels:  app

snowboard

Docker Repository on Quay

API blueprint toolkit.

Winter theme with playground enabled

Packages

NPM Version
snowboard npm version
snowboard-reader npm version
snowboard-parser npm version
snowboard-helper npm version
snowboard-linter npm version
snowboard-mock-router npm version
snowboard-seeder npm version
snowboard-packer npm version
snowboard-theme-helper npm version
snowboard-theme-winter npm version

Docker

You can also use automated build docker image on quay.io/bukalapak/snowboard:

$ docker pull quay.io/bukalapak/snowboard
$ docker run -it --rm quay.io/bukalapak/snowboard help

To run snowboard with the current directory mounted to /doc:

$ docker run -it --rm -v $PWD:/doc quay.io/bukalapak/snowboard html -o outDir API.apib

Usage

Let's say we have API Blueprint document called API.apib, like:

# API
## GET /message
+ Response 200 (text/plain)

        Hello World!

There are some scenarios we can perform, like:

# generate HTML documentation
$ snowboard html -o outDir API.apib

# run mock server
$ snowboard mock API.apib

# and more, see sections below

HTML Documentation

To generate HTML documentation, we can do:

$ snowboard html -o outDir API.apib

Above command will generate HTML documentation in output directory using snowboard default template (called winter).

Template Overrides

Snowboard let you override part of the template, you can override template, javascript and stylesheet. You can define it under html config:

const { resolve } = require("path");

module.exports = {
  html: {
    overrides: {
      "pages/Home.svelte": resolve(process.cwd(), "custom/Home.svelte"),
      "lib/helper/colorize.js": resolve(process.cwd(), "custom/colors.js"),
      "index.css": resolve(process.cwd(), "path-to-style.css")
    }
  }
};

HTTP Server

If you want to access HTML documentation via HTTP, you can use http sub-command:

$ snowboard http API.apib

With this flag, you can access HTML documentation on localhost:8088.

If you need to customize binding address, you can use flag -b.

API Playground

You can activate the playground feature to let your users interact with your staging or even production API.

Playground requires a configuration contains supported environments and the name of the default environment. On each environment, you can set an authentication option.

Here's the example of playground configuration along with the different authentication combination supported:

module.exports = {
  html: {
    playground: {
      enabled: true,
      hidden: false,
      env: "development",
      environments: {
        development: {
          url: "http://localhost:8087/",
          auth: {
            name: "apikey",
            options: {
              key: "api-dev-key",
              header: "X-Api-Key"
            }
          }
        },
        staging: {
          url: "https://staging.example.com/",
          auth: {
            name: "basic",
            options: {
              username: "admin",
              password: "secret"
            }
          }
        },
        production: {
          url: "https://api.example.com",
          auth: {
            name: "oauth2",
            options: {
              authorizeUrl: "https://accounts.example.com/oauth/authorize",
              tokenUrl: "https://accounts.example.com/oauth/access_token",
              callbackUrl: "https://www.example.com",
              clientId: "<client-id>",
              scopes: "<scope-names>"
            }
          }
        }
      }
    }
  }
};

Once you have a configuration file, named snowboard.config.js, you can do:

$ snowboard html -o outDir API.apib

# http sub-command works too
$ snowboard http API.apib

To disable playground on particular environment, you can add playground: false under environment configuration, like:

module.exports = {
  html: {
    playground: {
      enabled: true,
      env: "development",
      environments: {
        development: {
          url: "http://localhost:8087/",
          playground: false
        },
        staging: {
          url: "https://staging.example.com/"
        }
      }
    }
  }
};

Mock Server

Another snowboard useful feature is having a mock server. You can use mock sub-command for that.

$ snowboard mock API.apib

Then you can use localhost:8087 for accessing mock server. You can customize the address using flag -b.

For multiple responses, you can set Prefer header to select a specific response:

Prefer: status=200

You can also supply multiple inputs for mock sub-command:

$ snowboard mock API.apib OTHER.apib

Mock Server Authentication

The mock server supports various authentication, you can enable that by passing a configuration file using configuration file snowboard.config.js, like:

$ snowboard mock API.apib

Here's the example of the configuration file for mock server:

API key authentication

module.exports = {
  mock: {
    auth: {
      name: "apikey",
      options: {
        key: "<api-key>",
        header: "<Header-Name>"
      }
    }
  }
};

Basic authentication

module.exports = {
  mock: {
    auth: {
      name: "basic",
      options: {
        username: "<username>",
        password: "<password>"
      }
    }
  }
};

Other Features

Besides the above features, snowboard also has several useful features for working with API blueprint:

Validate API blueprint

Besides rendering to HTML, snowboard also support validates API blueprint document. You can use lint sub-command.

$ snowboard lint API.apib

Using flag --json, you will receive output as JSON format.

Render API Element JSON

In case you need to get API element JSON output for further processing, you can use:

$ snowboard json API.apib

List Routes

If you need to list all available routes for current API blueprints, you can do:

$ snowboard list API.apib ANOTHER.apib

Using flag --json, you will receive output as JSON format.

SSL Support

To enable HTTPS server, both http, and mock subcommand supports SSL configuration. You can do:

# http server
$ snowboard http -S -C cert.pem -K key.pem API.apib

# mock server
$ snowboard mock -S -C cert.pem -K key.pem API.apib

For example, for local development, you can utilize mkcert to create your local development certificate and use it with snowboard:

# generate localhost certificate
$ mkcert -install
$ mkcert localhost

# use the generated certificate with snowboard http or mock subcommand
$ snowboard http -S -C localhost.pem -K localhost-key.pem API.apib

# you can now access using https://localhost:8088/

Watcher Support

To enable auto-regeneration on input files updates, you can add global flag --watch

$ snowboard html --watch -o outDir API.apib

# http server
$ snowboard http --watch API.apib

Help

$ snowboard help
API blueprint toolkit

VERSION
  snowboard/4.0.0

USAGE
  $ snowboard [COMMAND]

COMMANDS
  apib  render API blueprint
  help  display help for snowboard
  html  render HTML documentation
  http  serve HTML documentation
  json  render API elements json
  lint  validate API blueprint
  list  list API routes
  mock  run mock server
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].