Challenge: Request Header Parser Microservice Solution

What is your hint or solution suggestion?
Solution:

var express = require('express');
var app = express();

app.get("/api/whoami", (req, res) => {
    let ueserInfo = {
        "ipaddress": req.ip,
        "language": req.headers['accept-language'].toString(), 
        "software": req.headers['user-agent'].toString()
    }
    res.json(ueserInfo);
})

var listener = app.listen(process.env.PORT, function () {
    console.log('Your app is listening on port ' + listener.address().port);
});

Challenge: Request Header Parser Microservice

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.