Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.29 KB

install.md

File metadata and controls

63 lines (51 loc) · 1.29 KB

Install

Git and cargo

Clone the repo and build the database from source

git clone https://github.com/kruserr/rapiddb.git
cd rapiddb
cargo run --release

Add to your cargo project

Cargo.toml

[dependencies]
tokio = { version = "1", features = ["full"] }
warp = "0.3"
rapiddb-web = "0.1"

src/main.rs

#[tokio::main]
async fn main() {
  let db = rapiddb_web::rapiddb::db::MMAVAsyncDatabase::new();

  warp::serve(rapiddb_web::api::endpoints(db)).run(([0, 0, 0, 0], 3030)).await;
}

Run the database with cargo

cargo run --release

Use the database with curl

Using the database directly without the REST API

The database can be used by itself without building the REST API, by using the rapiddb crate instead of the rapiddb-web crate.

Cargo.toml

[dependencies]
rapiddb = "0.1"

src/main.rs

use rapiddb::traits::IDatabase;

pub fn main() {
  let db = rapiddb::db::MMAVDatabase::new();

  let value = b"{\"key\": \"value\"}";
  db.post("test-0", value);
  assert_eq!(db.get_latest("test-0"), value);
}

Run the database with cargo

cargo run --release