How can I do this type of thing on node/express
app.get("/users/:id/state/:state", (req, res) => {
if (req.params.state== 'Published') {
//do somehting
} else {
//do something
}
});
but filtering by state?
Exampe, I wanna have this type of route /users/123/posts?state=published,
how do I have to hendle it on node?