This my code:
router.all('/trips:key?', (req, res) => {
console.log("Yeah")
console.log(req.params.key)
})
GET http:localhost:8080/trips?keyword=kong
Output :
Yeah
undefined
How to get value kong in keyword
Thank you.
>Solution :
hope this will work for GET http:localhost:8080/trips?keyword=kong
your route should be /trips not /trips:key?
router.all('/trips', (req, res) => {
console.log("Yeah")
console.log(req.query.keyword)
})