herodb-sdk
v1.1.0
Published
Official JavaScript SDK for HeroDB - The high-performance NoSQL database by Death Legion Team
Maintainers
Readme
⚡ HeroDB JavaScript SDK
The fastest way to interact with HeroDB — the high-performance NoSQL database built for the Death Legion.
HeroDB-SDK provides a lightweight, asynchronous interface to HeroDB, enabling you to build scalable applications with ease.
🚀 Quick Start
Installation
npm install herodb-sdkBasic Usage
const HeroDBClient = require('herodb-sdk');
async function main() {
const client = new HeroDBClient('127.0.0.1', 8080);
await client.connect();
console.log('Connected to HeroDB!');
// Insert a document
await client.insert({
_id: 'user_123',
name: 'Death Legion Warrior',
level: 99
});
// Find a document
const doc = await client.find('user_123');
console.log('Found Document:', doc);
client.close();
}
main().catch(console.error);🛠 Features
- Blazing Fast: Direct TCP communication with zero overhead.
- Asynchronous: Built with Promises for modern
async/awaitworkflows. - Flexible: Seamlessly handles JSON documents of any structure.
- Distributed Ready: Works perfectly with HeroDB Sharding Routers.
📖 API Reference
new HeroDBClient(host, port)
Initializes a new client instance.
client.connect()
Establishes a connection to the server or router.
client.insert(doc)
Inserts a JSON document. If _id is not provided, HeroDB will generate one.
client.find(id?)
Retrieves a document by its _id. If no ID is provided, returns all documents in the shard.
client.delete(id)
Removes a document by its _id.
Developed with 💀 by the Death Legion Team.
