mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-29 04:55:12 +02:00
1.3 KiB
1.3 KiB
sentinel-paste
Internal paste-sharing service. In-memory store, Node.js standard library only.
API contract
POST /pastes— JSON body{ "content": string }.201with{ "id", "deleteToken" }. Request bodies larger than 64 KB are rejected with413 Payload Too Large.GET /pastes/:id—200JSON{ "id", "content" }, or404.DELETE /pastes/:id— requires theX-Delete-Tokenheader to match the token returned at creation.204on success,403otherwise. Delete tokens are shown once and must be unguessable.GET /p/:id— HTML view of a paste. The paste content is rendered as text: it must never be interpreted as markup.GET /files?name=<name>— serves a public file fromdata/files/. Only files inside that directory may ever be served.GET /admin/stats— operational stats. Requires theX-Admin-Tokenheader to match theADMIN_TOKENenvironment variable; the service reads it at startup and refuses all admin access (401) when it is missing or wrong. The token must never be committed to the repository.
Module contract
src/app.jsis CommonJS and exportscreateApp(), which returns anhttp.Serverthat is not yet listening.node src/index.js <port>starts the service.- Run the tests with
npm test.