nabia-client

Nabia-compatible HTTP client for interacting with Nabia servers.
Quick Start
Prerequisites
- Go 1.22 or higher
- A running Nabia server instance
Installation
# Clone the repository
git clone https://github.com/Nabia-DB/nabia.git
cd nabia/client
# Install dependencies
go mod download
# Build the application
go build -o nabia-client .
Usage
The nabia-client supports all HTTP methods that the Nabia server implements:
Configuration
The client can be configured using command-line flags or environment variables:
# Command-line flags
./nabia-client --host localhost --port 5380 GET mykey
# Environment variables
export NABIA_HOST=localhost
export NABIA_PORT=5380
./nabia-client GET mykey
Basic Operations
GET - Retrieve a value:
./nabia-client GET mykey
POST - Create a new key-value pair:
# From command line
./nabia-client POST mykey "Hello, World!"
# From file
./nabia-client POST mykey --file /path/to/file.txt
PUT - Create or update a key-value pair:
# From command line
./nabia-client PUT mykey "Updated value"
# From file
./nabia-client PUT mykey --file /path/to/file.txt
DELETE - Remove a key:
./nabia-client DELETE mykey
HEAD - Check if a key exists:
./nabia-client HEAD mykey
OPTIONS - Get allowed methods for a key:
./nabia-client OPTIONS mykey
Working with Files
The client can handle file uploads and downloads:
# Upload a file
./nabia-client POST image.jpg --file /path/to/image.jpg
# The client automatically detects MIME types for files
Content Types
The client automatically handles content types:
- Text data is sent as
text/plain; charset=utf-8
- File uploads use automatic MIME type detection
- Binary data defaults to
application/octet-stream
API Compatibility
This client is compatible with the Nabia server API. Read the full specification.
Development
Running Tests
go test ./...
Building from Source
go build -o nabia-client .
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add some amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Merge Request
License
See LICENSE file for details.