Quote API working in Postman but not in browser

Hi, I just finished the Quote API freeform project. It all seems to be up and running fine when I send the requests to localhost:4001 on Postman, but when I go to localhost:4001 in the browser and see the pre-created Quote API website, nothing works.

When I click “get random quote” it returns “undefined - undefined”, when I click “get all quotes” it returns “Your request returned no quotes”. Is there some connection that I haven’t made?

If it’s helpful, here is all the code from my server.js:

const express = require(“express”);

const app = express();

const { quotes } = require("./data");

const { getRandomElement } = require("./utils");

const PORT = process.env.PORT || 4001;

app.listen(PORT, () => {

console.log(Listening on port ${PORT});


//GET random quote

app.get("/api/quotes/random", (req, res, next) => {



//GET all quotes or quotes filtered by person

app.get("/api/quotes", (req, res, next) => {

const person = req.query.person;

if (person) {

const newArray = quotes.filter((quote) => quote.person === person);


} else {




//POST new quote

app.post("/api/quotes", (req, res, next) => {

const quoteText = req.query.quote;

const quotePerson = req.query.person;

if (quoteText && quotePerson) {

const newQuote = req.query;



} else {

res.status(400).send("Include both quote text and a person");





In response part it should be:
res.send({ quotes: quotes });
or in first case:
res.send({ quotes: newArray });

The front-end wants a whole object to work, ie. the response sent needs to be

‘res.send( {quote: [your random quote variable] } )’:

ie. if your variable returned from the getRandomElement() helper method is

‘const randomQ = getRandomElement(quotes)’

the response sent should be:

res.send( { quote: randomQ } );

Was likewise very confused by this because it was working in Postman/CLI console for me too, but yeah it’s seemingly just an issue of what the prewritten front-end code wants.