node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

skyway

skyway

NPM version Dependency Status Dev Dependency Status Code Climate Build Status Coverage Status

An express routing library that leverages swagger (open api) definitions to validate incoming and outgoing data.

Note: This is a pre 1.0.0 version. Although I will try hard to keep the API the same or similar, I will sacrifice a poor api design in favor of a simpler, clearer, and all-together better api.

For information on the swagger api, visit the official site or the official spec

Installation

yarn add skyway
# or 
npm install --save skyway
const express = require('express')
const skyway = require('skyway')
const bodyParser = require('body-parser')
const routes = require('./routes')
 
const app = express()
const api = skyway(`${__dirname}/swagger.yaml`)
 
app.get('/swagger.json', api.docs())
app.use('/docs', api.ui('/swagger.json'))
app.use(api.routes({
  parsers: {
    'application/json': bodyParser.json()
  }
}))
app.use(routes)
 
app.listen(8000)

Docs

The API docs for this version are located here. Swagger 2.0 is the only version supported at the moment, but when OpenAPI Spec 3.0 comes out, I will support both.