Sign inSign up

mauriciolobo/echoserver

By mauriciolobo

•Updated over 1 year ago

a simple echo server used to learn load balancer, dispatcher, CDN, WAF, Reverse Proxy

Image
0

520

mauriciolobo/echoserver repository overview

⁠Echo Server

The Echo Server is a simple Node.js application built with Express.js that intercepts all incoming HTTP requests and responds with detailed information about the request, the system, and the environment. https://github.com/mauriciolobo/echoserver⁠

⁠Features

  • Returns detailed request information (method, path, headers, query, body, etc.).
  • Provides system information such as hostname, platform, architecture, CPU count, memory usage, and uptime.
  • Includes Docker and Kubernetes metadata if running in a containerized environment.
  • Exposes all environment variables in the response.

⁠Prerequisites

⁠Running the Server

⁠Locally
  1. Install dependencies:

    npm install
    
  2. Start the server:

    node src/index.js
    
  3. The server will be running at http://localhost:3000.

⁠Using Docker
  1. Pull the Docker image from Docker Hub:

    docker pull mauriciolobo/echoserver:latest
    
  2. Run the container:

    docker run -p 3000:3000 mauriciolobo/echoserver:latest
    
  3. The server will be accessible at http://localhost:3000.

⁠API

The server intercepts all HTTP requests and responds with a JSON object containing the following sections:

  • request: Details about the incoming request (method, path, headers, query, body, etc.).
  • system: Information about the system where the server is running (hostname, platform, architecture, etc.).
  • docker: Metadata about the Docker or Kubernetes environment (if applicable).
  • env: All environment variables available to the server.

⁠Example Response

{
  "request": {
    "method": "GET",
    "path": "/",
    "headers": { ... },
    "query": {},
    "body": {},
    "params": {},
    "cookies": {},
    "ip": "::1",
    "remoteAddress": "::1",
    "protocol": "http",
    "secure": false,
    "originalUrl": "/",
    "baseUrl": "",
    "hostname": "localhost",
    "subdomains": []
  },
  "system": {
    "hostname": "my-host",
    "platform": "linux",
    "arch": "x64",
    "cpus": 4,
    "totalmem": 16777216,
    "freemem": 8388608,
    "uptime": 12345,
    "loadavg": [0.1, 0.05, 0.01],
    "networkInterfaces": { ... }
  },
  "docker": {
    "container_id": "abc123",
    "pod_name": null,
    "pod_namespace": null,
    "pod_ip": null,
    "node_name": null
  },
  "env": { ... }
}

⁠License

This project is licensed under the MIT License.

Tag summary

Content type

Image

Digest

sha256:98363e54f…

Size

58.5 MB

Last updated

over 1 year ago

docker pull mauriciolobo/echoserver