Registry / database / rest-on-couch-client

rest-on-couch-client

JSON →
library8.0.1jsnpmunverified

A Node.js and browser client for rest-on-couch, a RESTful database backend. This package provides a convenient API to interact with rest-on-couch servers, supporting CRUD operations, Mango queries (find API), and bulk operations. Version 8.0.1 is the latest stable release, with regular updates following the rest-on-couch server version. It ships TypeScript types and works in both Node.js and browser environments. Compared to raw HTTP clients, it abstracts authentication, error handling, and response parsing specific to rest-on-couch.

npm install rest-on-couch-client
INSTALL
IMPORT
SIG · REST-ON-COUCH-CLIE
R
rest-on-couch-client
databasejavascriptv8.0.1
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.

ROCClient
import { ROCClient } from 'rest-on-couch-client'
const ROCClient = require('rest-on-couch-client')
ESM-only since v8; CommonJS require() will not work.
ROCClient
import type { ROCClient } from 'rest-on-couch-client'
TypeScript type import for type-checking only.
default
import ROCClient from 'rest-on-couch-client'
import { default as ROCClient } from 'rest-on-couch-client'
The package also exposes a default export which is the same as the named export ROCClient.

Shows how to create a ROCClient instance with authentication, post a document, and retrieve documents with a filter.

import { ROCClient } from 'rest-on-couch-client'; const client = new ROCClient({ base: 'https://your-rest-on-couch-server.com', token: process.env.ROC_TOKEN ?? '' }); async function main() { const result = await client.post('collection', { name: 'test' }); console.log('Created:', result); const docs = await client.get('collection', { filter: { name: 'test' } }); console.log('Found:', docs); } main().catch(console.error);
Debug
Known issues
breakingBREAKING CHANGE: v8 drops CommonJS support. Code using require() will fail.
fix
Switch to ESM imports: import { ROCClient } from 'rest-on-couch-client'
affects: >=8.0.0
Errors
Common errors & fixes
TypeError: Cannot destructure property 'ROCClient' of 'require(...)' as it is undefined.
Using CommonJS require() with an ESM-only package.
fix
Change to ESM import: import { ROCClient } from 'rest-on-couch-client'
Upgrade
Version history
8.0.1latest on npm
Audit
Dependencies
rest-on-couch-clientrequiredThe package is self-contained but may need peer dependencies like fetch API in browsers; includes internal dependencies for HTTP requests.
Agent activity
10 hits · last 30 days
node
10
Resources
rest-on-couch-client — npm install rest-on-couch-client · libregistry