Skip to content

Instantly share code, notes, and snippets.

@hc3
Created November 20, 2016 07:04
Show Gist options
  • Save hc3/28a70deb72c31b2ebb5e44f631467d14 to your computer and use it in GitHub Desktop.
Save hc3/28a70deb72c31b2ebb5e44f631467d14 to your computer and use it in GitHub Desktop.
module.exports = (Models, MODEL_NAME, options, include) => (req, res, next) => {
options.offset = options.limit * req.params.pag
options.include = include
<<<<<<< HEAD
=======
>>>>>>> 2936f247729636a926e85e675976a2b1aa9f086c
Models[MODEL_NAME].findAll(options)
.then((data) => {
res.json(data)
})
.catch((error) => {
// res.json(error)
console.log('error', error)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment