Skip to content

Instantly share code, notes, and snippets.

@myndzi
Last active May 14, 2017 20:03
Show Gist options
  • Save myndzi/6d0f43dcd96ef89565d47429977eaf19 to your computer and use it in GitHub Desktop.
Save myndzi/6d0f43dcd96ef89565d47429977eaf19 to your computer and use it in GitHub Desktop.
var resource = app.swag.createResource('Foo');
resource.get('/foo', {
name: 'Foos',
params: {
filter: 'string',
itemsPerPage: 'integer'
},
returns: 'SomeModel' //models are declared elsewhere/separately
}, function (req, res) {
// req.params is already validated; return value is also validated or else an error response is returned
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment