An intentionally small, fetch-based package that is useful for quick API-client experiments.
npm install tiny-ok-message- One small exported helper:
getOkMessage - Accepts a typed input object shaped as
{ message: string } - Calls the DummyJSON HTTP 200 endpoint with a URL-encoded message
- Returns a typed response shaped as
{ status: string; message: string } - TypeScript ready with generated declaration files
- ESM package output through
dist - Unit tested with Jest and
ts-jest
/* node modules */
import { getOkMessage } from 'tiny-ok-message';
/* example */
async function run() {
const response = await getOkMessage({ message: 'hello world' });
console.log(response);
}
await run();Expected response shape:
{ status: "200", message: "hello world" }PASS src/messages/test/get-ok-message.test.ts
getOkMessage
✓ fetches the OK message from DummyJSON
✓ throws when the request fails-------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
get-ok-message.ts | 100 | 100 | 100 | 100 |
-------------------|---------|----------|---------|---------|-------------------- This package is open source and designed as a tiny API helper for the public DummyJSON HTTP endpoint. It does not collect, store, sell, rent, trade, monetize, or process personal data for its own purposes.
- The package only makes HTTP requests as part of its documented behavior. Any data handled by the package is limited to the
messagevalue explicitly provided by the consuming application. - This package does not include analytics, tracking, telemetry, advertising, hidden background services, install scripts, or project-owned data collection systems.
Like this project? Support it with a GitHub star. Cheers and happy coding.
