Request Header Parser Microservice
Get a browser's IP address, preferred languages, and system information.
How it Works
This microservice uses Koa to retrieve request headers and, along with koa-router, serve requests.
How to Use
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.
API Resources
GET /
Returns an object containing information about the client's browser.
REQUEST
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
RESPONSE
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"
}