express rest api with optional parameters code example
Example 1: make query param optional node
app.get('path/:required/:optional?*, ...)
Example 2: make query param optional node
app.get('/user/:id?', function userIdHandler (req, res) {
console.log(req.route)
res.send('GET')
})