Registry / devops / resty-client

resty-client

JSON →
library0.0.5jsnpmunverified

Simple HTTP and REST client library built on top of axios for Browser and Node.js, inspired by Go's resty. Current stable version 0.0.5 (prerelease). Release cadence is irregular as it is a young project. Key differentiators: centralized request management, middleware support for requests and responses, and a simple API similar to Go's resty. However, it is still in early development with limited adoption and documentation.

npm install resty-client
INSTALL
IMPORT
SIG · RESTY-CLIENT
R
resty-client
devopsjavascriptv0.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import resty from 'resty-client'
const resty = require('resty-client')
Package is ESM-only; CommonJS require will fail.
resty interface (instance)
const client = resty.create()
const client = new resty()
Use static create() method to instantiate a client, not constructor.
RequestConfig type
import type { RequestConfig } from 'resty-client'
TypeScript types are bundled; import type for config objects.

Shows how to create a Resty client with baseURL and timeout, then make a GET request with params.

import resty from 'resty-client'; const client = resty.create({ baseURL: 'https://api.example.com', timeout: 5000, headers: { 'Content-Type': 'application/json' } }); async function getUser() { try { const response = await client.get('/user/123', { params: { id: 123 } }); console.log(response.data); } catch (error) { console.error(error); } } getUser();
Debug
Known issues
breakingImport path changed from 'resty' to 'resty-client' in v0.0.5
fix
Update import to 'resty-client'.
affects: <0.0.5
gotchaAll methods return Promise; must be awaited or .then() used
fix
Use await or .then() when calling client.get/post etc.
affects: >=0.0.0
breakingNo CommonJS support; package is ESM-only (type: module in package.json)
fix
Use ESM imports (import/export) or configure Node to handle ESM.
affects: >=0.0.0
gotchaAuth config uses HTTP Basic only via `auth` property; no bearer token support in config
fix
Set Authorization header manually for bearer tokens.
affects: >=0.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Using import in CommonJS environment without ESM support.
fix
Add 'type': 'module' to package.json or switch to .mjs file extension.
resty.create is not a function
Attempting to use default import without calling create; or using old v0.0.4 where create was named differently.
fix
Ensure you import resty from 'resty-client' and call resty.create(config).
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
axiosrequiredUnderlying HTTP client; Resty Client wraps axios for a simplified interface.
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
resty-client — npm install resty-client · libregistry