SurrealDB

1 min read


Hello Stackers, no we talk about SurrealDB. SurrealDB is an innovative NewSQL cloud database, suitable for serverless applications, jamstack applications, single-page applications, and traditional applications. It is unmatched in its versatility and financial value, with the ability for deployment on cloud, on-premise, embedded, and edge computing environments. For a hassle-free setup, get started with SurrealDB Cloud in one-click.

SurrealDB is the ultimate cloud database for tomorrow’s application

SurrealDB

Quick Start

Start the server

First, start the SurrealDB server. Under macOS or Linux, run the following command from a terminal window:

user@localhost % surreal start --log debug --user root --pass root memory
[2022-07-28 15:50:34] INFO  surrealdb::iam Root authentication is enabled
[2022-07-28 15:50:34] INFO  surrealdb::dbs Database strict mode is disabled
[2022-07-28 15:50:34] INFO  surrealdb::kvs Starting kvs store in memory
[2022-07-28 15:50:34] INFO  surrealdb::kvs Started kvs store in memory
[2022-07-28 15:50:34] INFO  surrealdb::net Starting web server on 0.0.0.0:8000
[2022-07-28 15:50:34] INFO  surrealdb::net Started web server on 0.0.0.0:8000

From Windows, run the following command from a command prompt window:

PS C:\> surreal.exe start --log debug --user root --pass root memory
[2022-07-28 15:50:34] INFO  surrealdb::iam Root authentication is enabled
[2022-07-28 15:50:34] INFO  surrealdb::dbs Database strict mode is disabled
[2022-07-28 15:50:34] INFO  surrealdb::kvs Starting kvs store in memory
[2022-07-28 15:50:34] INFO  surrealdb::kvs Started kvs store in memory
[2022-07-28 15:50:34] INFO  surrealdb::net Starting web server on 0.0.0.0:8000
[2022-07-28 15:50:34] INFO  surrealdb::net Started web server on 0.0.0.0:8000

Connect to SurrealDB

Now that you have started a server, you can connect in a number of ways. In this quick start guide we will insert and query data using the SurrealQL REST endpoint. This endpoint runs SurrealQL queries which are submitted as a HTTP POST request.

DATA="INFO FOR DB;"
curl --request POST \
	--header "Content-Type: application/json" \
	--user "root:root" \
	--data "${DATA}" \
	http://localhost:8000/sql
[
  {
    "time": "141.334µs",
    "status": "ERR",
    "detail": "You need to specify a namespace and a database to use"
  }
]

Okay that’s All, for the full documentation we can refer on here.. cyaa ..

Bima Sena

Leave a Reply

Your email address will not be published. Required fields are marked *