An Optic fixture for documenting Sails JS
Last updated 4 months ago by acunniffe .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @useoptic/document-sails 
SYNC missed versions from official npm registry.

Using Optic with Sails

Optic's documenting middleware for Sails.


Install as a dev dependency

npm install @useoptic/document-sails --save-dev

Optic documents your API based on the HTTP requests it observes during testing. The Sails docs recommend using supertest for this kind of tests.

Instead of passing sails.hooks.http.app into supertest directly, you need to wrap the sails instance with Optic's documenting middleware:

import withOptic from '@useoptic/document-sails'
import sails from 'sails'
const appWithOptic = withOptic(sails)

Now Optic can observe the test traffic and learn the specs for each of the endpoints you tests.

import withOptic from '@useoptic/document-sails'
import sails from 'sails'
import supertest from 'supertest';
const appWithOptic = withOptic(sails) 

//Example Test
it('can get a list of users', (done) => {
       .expect(200, done)  

Current Tags

  • 0.1.0                                ...           latest (4 months ago)

1 Versions

  • 0.1.0                                ...           4 months ago
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (0)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |