To get the GET query parameters in an Express.js server, you can use the query property of the request object.
Here’s an example of how you can get the GET query parameters in an Express.js server using the query property:
const express = require('express');
const app = express();
app.get('/', (req, res) => {
console.log(req.query); // { foo: 'bar', baz: 'qux' }
});
app.listen(3000);
In this example, the query property of the request object contains the GET query parameters as an object. You can access the individual query parameters using dot notation or bracket notation.
Express.js automatically parses the query string and assigns the values to the query property, so you don’t need to use a separate query string parsing library.
