Skip to content

yuri-karelics/any-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

any-api

Simple Node.js + TypeScript API with one POST endpoint that writes request bodies to file logs.

What it does

  • Exposes POST endpoint: /ingest (customizable via POST_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

Run locally

npm install
npm run build
npm start

Send request:

curl -X POST http://localhost:3000/ingest \
  -H "Content-Type: application/json" \
  -d '{"hello":"world"}'

Run in Docker

docker compose up --build

Then send the same curl request to http://localhost:3000/ingest.

Environment variables

  • PORT (default: 3000)
  • POST_ENDPOINT_NAME (default: ingest)
  • LOG_DIR (default: ./logs locally, /app/logs in Docker)

About

Test NodeJS API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors