Skip to content

Commit

Permalink
feat(#143): create quotes controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank0255 authored and lelouchB committed Nov 18, 2020
1 parent 912b930 commit 3fedb57
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 3fedb57

Please sign in to comment.