PS: built for freecodecamp backend challenge series
Clone the repo and self-host it somewhere, preferrably in the cloud.
Following are the exposed api endpoints
Endpoint | Usage |
---|---|
/api/whoami | returns json with a default configured request header information |
The default configuration for the api/whoami only has very few header information. User can update the configuration to make it work according to his own needs
Go to /api/routes.js file and edit the following parameters for custom header results
const ipaddrs = req.headers.host;
const lang = req.headers['accept-language'];
const sw = req.headers['user-agent'];
res.json({
"ipaddress" : ipaddrs,
"language":lang,
"software":sw
})
Endpoint | Usage |
---|---|
req.header.host | ip address of client |
req.header.connection | connection type |
req.header['user-agent'] | UserAgent of the client |
req.header['accept-language'] | client language |