README
Using Optic with Sails
Optic's documenting middleware for Sails.
Usage
Install the node module from npm:
npm install @useoptic/document-sails
Add the Optic documenting middleware to config/http.js
. The middleware will be skipped by default and will never run in production. It only runs when your tests were started by optic api:document
. Every HTTP request your run to test your API will be used by Optic to infer the current API contract.
module.exports.http = {
middleware: {
order: [
'cookieParser',
'session',
'bodyParser',
'compress',
'poweredBy',
'documentSails', //Optic always goes just before router
'router',
'www',
'favicon'
],
documentSails: require('@useoptic/document-sails') //import middleware from package
}
}