Quote API

Hi Coders,

I just finished

Quote api and my code seems fine but none of the requests actuallywork and all rerurn 404 (Not Found).

Since the only code editing happened in server.js i paste the code below. Perhaps i have some silly mistake I overlooked :face_with_raised_eyebrow:

const express = require('express');
const app = express();

const { quotes } = require('./data');
const { getRandomElement } = require('./utils');

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

app.use(express.static('public'));


app.get('/api/quotes/random', (req, res, next) => {
  const quote = getRandomElement(quotes);
  res.send({quote: quote});
});

app.get('/api/quotes/', (req, res, next) => {
        const person = req.query.person;
        if (!person) {
            res.send({quotes: quotes});
        } else {
            let filteredQuotes = quotes.filter(quote => quote.person === person);
            res.send({quotes: filteredQuotes});
        }
});

app.post('/api/quote', (req, res, next) => {
  const { quote, person } = req.query;

  if ( !quote || !person ) {
    res.status(400).send()
  } else {
    const newQuote = {quote: quote, author: author};
    quotes.push(newQuote);
    res.send(newQuote);
  }
})



app.listen(PORT, () => {
    console.log(`Server is listening on ${PORT}`);
  });