Create a POST /soups route

Hi,
Anyone can take a look to my solution please.
A can’t find the bug in my code.
It is fails on the test.
Did you send back the new soup name?
The terminal is hidden at this challenge and I not able to check the value of name…
I don’t know how to open the terminal… :frowning:

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

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

const soups = ['gazpacho', 'borscht', 'primordial', 'avgolemono', 'laksa'];

app.post(" /soups", (req, res, next) => {
  const name = req.query.name;
  if (name) {
    soups.push(name);
    res.status(201).send(name);
  } else {
    res.status(400).send();
  }
});

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


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.