Is This PATH Even Valid

On the Timestam Project, a requirement is to have something like this:

app.get('/api/:date?', (req,res) => {
let date =;

However, if I have no queries, then why do I need to put the question mark at the end? It seems unnecessary.

It’s an optional parameter.

It basically just lets you use one route instead of two. So /api/:date? instead of /api and /api/:date

1 Like

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