how to extract the particular data using path parameters in node js code example
Example 1: express get query params from url
GET /something?color1=red&color2=blue
app.get('/something', (req, res) => {
req.query.color1 === 'red'
req.query.color2 === 'blue'
})
Example 2: express get raw query
const url = require('url');
const express = require('express');
const app = express();
app.use((req, res, next) => {
const query = url.parse(req.url).query;
});
const port = 3000;
app.listen(port, console.log(`Listening on port ${port}.`));