Simple Node.js + TypeScript API with one POST endpoint that writes request bodies to file logs.
- Exposes POST endpoint:
/ingest(customizable viaPOST_ENDPOINT_NAME) - Accepts any request body (JSON, form, text, or octet-stream)
- Writes each request as one JSON line into
logs/<endpoint>-YYYY-MM-DD.log - Creates a new log file each day automatically
npm install
npm run build
npm startSend request:
curl -X POST http://localhost:3000/ingest \
-H "Content-Type: application/json" \
-d '{"hello":"world"}'docker compose up --buildThen send the same curl request to http://localhost:3000/ingest.
PORT(default:3000)POST_ENDPOINT_NAME(default:ingest)LOG_DIR(default:./logslocally,/app/logsin Docker)