Skip to content

Commit

Permalink
feat(lelouchB#143): create quotes controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank0255 committed Nov 17, 2020
1 parent 4706411 commit d15f066
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backend/controllers/quote.api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const Quote = require("../models/quote.model")
const options = require("../helpers/options")

const getAllQuotes = async (req, res) => {
await Quote.find({}, null, options(req.query), (err, quotes) => {
if (err) {
return res.status(500).json({
success: false,
message: "Something went wrong.",
})
}
res.set("Cache-Control", "public, max-age=315576")
return res.json(Quote.structure(quotes))
})
}

module.exports = { getAllQuotes }

0 comments on commit d15f066

Please sign in to comment.