Regarding Route path

Tell us what’s happening:

I have passed this test, but was wondering if the mark

inside "/:word is a must?
Why don’t we just use “/word”?
I tried both url path and it all show me the same result, so what’s the difference?

app.get("/:word/echo", (req, res) => {
  const { word } = req.params;
    echo: word

Your project link(s)


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36.

Challenge: Get Route Parameter Input from the Client

Link to the challenge:

I you’ll use word the path will match exactly /word/echo, but if you use :word then the path will match anything like /whateveryoulike/echo and whateveryoulike will be accessible as a variable inside the route handler.

1 Like

I see! Thank you so much!