I am using the latest version of express.
Other query parameters are there, but the ones with dot are not.
Here is the part of 'req' object:
baseUrl: '/api/v1/bootcamps',
originalUrl: '/api/v1/bootcamps?housing=true&averageCost[lte]=10000&careers[in]=Business&location.city=MA',
_parsedUrl: Url {
protocol: null,
slashes: null,
auth: null,
host: null,
port: null,
hostname: null,
hash: null,
search: '?housing=true&averageCost[lte]=10000&careers[in]=Business&location.city=MA',
query: 'housing=true&averageCost[lte]=10000&careers[in]=Business&location.city=MA',
pathname: '/',
path: '/?housing=true&averageCost[lte]=10000&careers[in]=Business&location.city=MA',
href: '/?housing=true&averageCost[lte]=10000&careers[in]=Business&location.city=MA',
_raw: '/?housing=true&averageCost[lte]=10000&careers[in]=Business&location.city=MA'
},
params: {},
query: {
housing: 'true',
averageCost: { lte: '10000' },
careers: { in: 'Business' }
}
Hey there! I'm not currently able to reproduce this issue using the following server code using express v4.17.1
const express = require("express");
const app = express();
app.get("/test", (req, res) => {
console.log(req.query);
res.json({ ok: true, query: req.query });
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => console.log(`Server listening on port ${PORT}`));
Here is a codesandbox with the example running.
Hello to you too!
The problem was caused by 'express-mongo-sanitize' that I added as a piece of express middleware.
Once it was removed, everything worked fine. My fault, sorry.
Thanks anyway.
No worries, glad you were able to get unblocked and thanks for the update 鉂わ笍
Most helpful comment
Hello to you too!
The problem was caused by 'express-mongo-sanitize' that I added as a piece of express middleware.
Once it was removed, everything worked fine. My fault, sorry.
Thanks anyway.