Giter Site home page Giter Site logo

ambiere / headerparser Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 109 KB

Simple API built with Node.js and Express that extracts and parses information from HTTP request headers.

Home Page: https://headerparser.fly.dev/v0/api/headerparser

License: MIT License

JavaScript 65.93% Dockerfile 4.52% CSS 15.99% HTML 13.56%
express freecodecamp-project header-parser microservice nodejs

headerparser's Introduction

headerparser

The Request Header Parser is a simple API built with Node.js and Express that extracts and parses information from HTTP request headers. It provides endpoints to retrieve details such as IP address, preferred languages, software platform, and other relevant metadata from incoming HTTP requests.

js-standard-style   Test   Deployment  

Purpose

The Request Header Parser is designed to assist developers in retrieving and parsing essential client information from request headers, aiding in various use cases such as user analytics, language preferences, and client compatibility detection.

Features

  1. IP Address: Obtain the client's IP address from the request headers.
  2. Preferred Languages: Retrieve the preferred languages set in the client's browser.
  3. Software Platform: Identify the client's operating system and browser information.
  4. User-Agent Parsing: Extract user-agent details for detailed device and browser information.

Usage locally

1.0 Installation:

git clone https://github.com/zhid0399123/headerparser.git
cd headerparser
pnpm install

2.0 Start the Server:

npm start

The server runs on http://0.0.0.0:3000/v0/api/headerparser/whoami by default. You can modify the port in your .env file

3.0 Endpoint:

Send a GET request to http://0.0.0.0:3000/v0/api/headerparser/whoami endpoint to retrieve client's IP address, preferred languages, and user-agent information.

Example:

curl http://0.0.0.0:3000/v0/api/headerparser/whoami

Response:

{
  "id": "e7757827-c456-4354-9b98-b9ebfee29705",
  "ipAddress": "159.20.14.100",
  "languages": "en-US,en;q=0.5",
  "userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"
}

Deployment

The headerparser Microservice is deployed and accessible via fly.io, allowing users to interact with the API endpoints. Follow these steps to access the deployed API:

  1. Base URL: The deployed API can be accessed at https://headerparser.fly.dev/v0/api/headerparser/whoami.

  2. Usage Examples: Here's an example using cURL to convert a timestamp to Unix time:

curl -X GET https://headerparser.fly.dev/v0/api/headerparser/whoami

API Endpoints

GET /v0/api/headerparser/whoami Retrieve request header information.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests. Please refer to the Contributing Guidelines to get started.

License

This project is licensed under the MIT License. Refer to the LICENSE file for more details.

headerparser's People

Contributors

ambiere avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.