When they make a request to my creator server in Express, and I try to know the language, and the browser software, with req.language
and `req.software`` it gives me undefined
My current code is:
app.get('/api/whoami', (req, res, next)=> {
let json = {"ipaddress": req.ip, "language": req.language, "software": req.software}
res.json(json)
next()
})
to see the complete code in more detail visit https://replit.com/@Michael-Liendo/boilerplate-project-headerparser
CodePudding user response:
req.headers["user-agent"] // browser info
req.headers["accept-language"] // user's browser language