rahulkrishnan0 / request-header-parsing

A modern, minimal, fast api for request header parsing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

req-header-parse

PS: built for freecodecamp backend challenge series

Guide

Getting Started

Clone the repo and self-host it somewhere, preferrably in the cloud.

Endpoints

Following are the exposed api endpoints

Endpoint Usage
/api/whoami returns json with a default configured request header information

Configuration

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

Custom Configuration

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
})

Complete list of available headers

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

About

A modern, minimal, fast api for request header parsing


Languages

Language:JavaScript 100.0%