A lightweight REST library for JavaScript and TypeScript, version 0.8.0, with TypeScript declarations included. Designed for simplicity and browser/Node compatibility, it provides a minimalistic API for common HTTP methods (GET, POST, PUT, DELETE, PATCH) and supports custom headers, query parameters, request bodies, and response parsing. Unlike heavier solutions like Axios, Detritus REST focuses on zero dependencies and a small footprint (under 5KB). It has a monthly release cadence with occasional breaking changes in minor versions, so pinning is recommended. Primarily used in Discord bot development (part of the Detritus ecosystem) but suitable for any REST API consumption.
npm install detritus-restNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import RestClient, make a GET request with an auth header, and handle the response.
Use baseURL (camelCase) instead of baseUrl. Example: new RestClient({ baseURL: 'https://api.example.com' })Replace client.fetch('GET', url) with client.get(url) or the appropriate method.For non-JSON responses, access response.raw or set { responseType: 'text' } in request options.Pass a timeout option in milliseconds: client.get(url, { timeout: 5000 })Upgrade Node.js to version 14 or higher.
Run 'npm install detritus-rest' and ensure your import uses 'detritus-rest' not 'detritus-rest/lib'.
Use 'import { RestClient } from "detritus-rest"' in an ESM context or switch to dynamic import().Check the URL and response status; use response.raw to see the actual response text.
Ensure you await the request: const response = await client.get(url); and handle errors with try/catch.
No dependency data recorded yet.