Tiny, zero-dependencies HTTP echo server for Node.js 20+. Available as CLI tool or Docker container.
npx echo-srv [options]npm install -g echo-srvgit clone <repository-url>
cd echo-srv
npm linkecho-srv [options]Or with npx:
npx echo-srv [options]-port <number>- Server port (default: 3000)-headers- Log all HTTP headers-headers '<header1>,<header2>,...'- Log only specific headers (case-insensitive)-body- Log request body-cors- Enable CORS (Access-Control-Allow-* headers set to *)-help, --help- Show help message
Basic server on port 3000:
npx echo-srvCustom port with headers and body logging:
npx echo-srv -port 8080 -headers -bodyLog only specific headers:
npx echo-srv -headers 'Content-Type,Authorization'Enable CORS:
npx echo-srv -corsThe server logs each request in a structured format:
>>> [ 2025-10-13T12:34:56.789Z ]
GET /api/test?foo=bar
Query: {
"foo": "bar"
}
With -headers flag:
>>> [ 2025-10-13T12:34:56.789Z ]
GET /api/test
Query: none
Headers: {
"content-type": "application/json",
"authorization": "Bearer token"
}
With -body flag:
>>> [ 2025-10-13T12:34:56.789Z ]
POST /api/data
Query: none
Body: {"key":"value"}
All requests receive HTTP 200 OK with no body.
docker build -t echo-srv .
docker run -p 3000:3000 echo-srvdocker build \
--build-arg PORT=8080 \
--build-arg LOG_HEADERS=true \
--build-arg LOG_BODY=true \
--build-arg ENABLE_CORS=true \
-t echo-srv .docker run -p 8080:3000 echo-srvPORT- Server port (default: 3000)LOG_HEADERS- Log all headers (default: true)LOG_BODY- Log request body (default: true)ENABLE_CORS- Enable CORS (default: true)