I want to access navigator.language inside an node js file which is called using axios.get request. I tried to pass the navigator.language from Reactjs file while calling the get request as below:
axios.get('/apps/poe/powerStates', {data: {
navLanguage : navigator.language
}});
After going through, some of the links, I thought this would serve my purpose. But no, this didn't pass the navigator.language to the nodejs file where it checks for the navigator.language:
router.get('/example', async (req, res) => {
console.log(req.data); // shown as blank - {}
const {navLanguage} = req.data //thus gives me error
try{
........
} catch{
........
}
});
Note:- I have seen some external libraries like 'locale' but not looking to use any of the third party libraries for this purpose.
Is there any way for me to achieve this?