From 5fec6cf0039dbebac3a5f0036123561cad406efe Mon Sep 17 00:00:00 2001 From: Mayank Aggarwal Date: Tue, 17 Nov 2020 19:10:08 +0530 Subject: [PATCH] feat(#143): implement quotes route --- backend/config/endpoints.js | 12 ++++++++++++ backend/routes/routes.js | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/backend/config/endpoints.js b/backend/config/endpoints.js index ede4e35..10f3ee8 100644 --- a/backend/config/endpoints.js +++ b/backend/config/endpoints.js @@ -58,6 +58,18 @@ const endpoints = [ name: "Single Location", path: "/location/", }, + { + type: "GET", + name: "All Quotes", + path: "/quote", + queryParams: [ + { + optional: true, + name: "Sort By", + values: ["asc", "desc"], + }, + ], + }, ] module.exports = endpoints.map((endpoint) => { diff --git a/backend/routes/routes.js b/backend/routes/routes.js index be1b293..4008fa3 100644 --- a/backend/routes/routes.js +++ b/backend/routes/routes.js @@ -3,11 +3,13 @@ const router = express.Router() const characterController = require("../controllers/character.api.js") const episodeController = require("../controllers/episode.api.js") const locationController = require("../controllers/location.api.js") +const quoteController = require("../controllers/quote.api") const apiController = require("../controllers/api.js") const { getAllCharacters, getSingleCharacter } = characterController const { getAllEpisodes, getSingleEpisode } = episodeController const { getAllLocations, getSingleLocation } = locationController +const { getAllQuotes } = quoteController router.route("/character").get(getAllCharacters) router.route("/character/:id").get(getSingleCharacter) @@ -18,6 +20,8 @@ router.route("/episode/:id").get(getSingleEpisode) router.route("/location").get(getAllLocations) router.route("/location/:id").get(getSingleLocation) +router.route("/quote").get(getAllQuotes) + router.route("/").get(apiController.getAPI) router.route("*").get((req, res) => {