Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Use feathers-swagger and (feathers-)sequelize to add documentation from the models directly to Swagger

License

Notifications You must be signed in to change notification settings

Nvveen/feathers-swagger-sequelize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

feathers-swagger-sequelize

Greenkeeper badge Build Status

Use feathers-swagger and (feathers-)sequelize to add documentation from the models directly to Swagger

This version is configured to work with Swagger UI 3.x

Installation

npm install feathers feathers-swagger feathers-sequelize  feathers-swagger-sequelize

Basic example

import feathers from '@feathersjs/feathers'
import express from '@feathersjs/express'
import service from 'feathers-sequelize'
import swagger from 'feathers-swagger'
import Sequelize from 'sequelize'
import generateSwagger from 'feathers-sequlize-swagger'

const sequelize = new Sequelize('null', 'null', 'null', {
  storage: ':memory:',
  dialect: 'sqlite'
})
const User = sequelize.define(
  'users',
  {
    email: {
      type: Sequelize.STRING,
      description: 'An email-adres'
    },
    password: {
      type: Sequelize.STRING,
      description: 'A password'
    }
  },
  {
    description: 'A user'
  }
)
const app = express(feathers())
  .configure(express.rest())
  .configure(
    swagger({
      docsPath: '/docs',
      info: {
        title: 'API Documentation',
        description: 'API Documentation'
      }
    })
  )
  .use('/users', service({ Model: User }))
  .configure(generateSwagger)
app.listen(12345)

Go to localhost:12345 to see the generated documentation.

License

Copyright (c) 2018

Licensed under the MIT license

About

Use feathers-swagger and (feathers-)sequelize to add documentation from the models directly to Swagger

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published