Skip to content

Commit

Permalink
feat(lelouchB#143): implement quotes route
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank0255 committed Nov 17, 2020
1 parent d15f066 commit 5fec6cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions backend/config/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ const endpoints = [
name: "Single Location",
path: "/location/<id>",
},
{
type: "GET",
name: "All Quotes",
path: "/quote",
queryParams: [
{
optional: true,
name: "Sort By",
values: ["asc", "desc"],
},
],
},
]

module.exports = endpoints.map((endpoint) => {
Expand Down
4 changes: 4 additions & 0 deletions backend/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) => {
Expand Down

0 comments on commit 5fec6cf

Please sign in to comment.