Get a browser's IP address, preferred languages, and system information.
This microservice uses Koa to retrieve request headers and, along with koa-router, serve requests.
app.js
exports a Koa app. Koa apps have an app.listen()
method that is
identical to Node's http.Server.listen().
Import app.js
and call app.listen()
to start up the microservice.
Returns an object containing information about the client's browser.
Sample: https://request-header-parser-microservice.example.com/
Headers:
Accept-Language: en-US,en;q=0.5
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
X-Forwarded-For: 159.20.14.100
Status: 200 - application.json
Response:
{
"ipaddress": "159.20.14.100",
"language": "en-US,en;q=0.5",
"software": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"
}