You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cut-and-pasted the example from the readme document and found a few typos that cause compilation error. This is the version I tested working (as of the latest 8/30/2014 snapshot). It would be great it can be included in the next version of the update of the readme.
var express = require('express'),
swagger = require('swagger-jack');
var app = express();
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(swagger.generator(app, {
// general descriptor part
apiVersion: '2.0',
basePath: 'http://my-hostname.com/api'
}, [{
// descriptor of a given resource
api: {
resourcePath: '/user',
apis: [{
path: '/user/',
operations: [{
httpMethod: 'POST',
nickname: 'create',
responseClass: 'void'
}, {
httpMethod: 'GET',
nickname: 'list',
responseClass: 'void'
}]
}]
},
// controller for this resource
controller:
{
create: function(req, res, next) {
return res.send(200);
},
list: function(req, res, next) {
return res.send(200);
}
}
}]));
app.use(swagger.validator(app));
app.use(swagger.errorHandler());
app.get("/api/unvalidated", function(req, res, next) {
// not documented not validated
});
app.listen(8080);
The text was updated successfully, but these errors were encountered:
I cut-and-pasted the example from the readme document and found a few typos that cause compilation error. This is the version I tested working (as of the latest 8/30/2014 snapshot). It would be great it can be included in the next version of the update of the readme.
The text was updated successfully, but these errors were encountered: