diff --git a/backend/controllers/quote.api.js b/backend/controllers/quote.api.js new file mode 100644 index 0000000..ff8e8e2 --- /dev/null +++ b/backend/controllers/quote.api.js @@ -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 }