Update 2021: i tried url.format and querystring and both of them are deprecated, instead we can use URLSearchParams
const {URLSearchParams} = require('url') app.get('/category', (req, res) =>{ const pathname = '/?' const components ={ a:"a", b:"b" } const urlParameters = new URLSearchParams(components) res.redirect(pathname + urlParameters) })