Microservice to deploy Beardb Secured Databases Remotely.
Project description
BearDB MicroService
A microservice using the Beardb database system is a standalone service that is designed to deploy JSON databases remotely and provide API endpoints for accessing the data stored in these databases. This microservice utilizes the Beardb database system, which is a highly scalable and flexible database management system that is specifically designed to handle large amounts of data in the form of JSON documents.
The microservice provides a set of API endpoints that allow users to retrieve data from the JSON databases that are deployed on the server. These API endpoints can be accessed using HTTP POST requests, and they return data in the form of JSON objects. This allows users to easily access and manipulate the data stored in the databases, and it also enables them to integrate the microservice with other systems and applications.
Introduction
Install Libaries
$ python3 -m pip install BeardbAPI
$ python3 -m pip install gunicorn
Import Libraries
from BeardbAPI.API import BeardbAPI
Running the Development MicroService
run.py
test = BeardbAPI()
test.run(host='127.0.0.1',port=5555)
Terminal
$ python3 run.py
Running the Production MicroService
run.py
test = BeardbAPI()
api = test.service()
Terminal
$ gunicorn run:api
The file system automatically starts the database environment in the current directory of the driver code. To avoid that pass in the directory you want to make the database enviroment. Run the following code
test.storage(app_name='test_app',dir='')
Optimal Driver Code (Development)
run.py
test = BeardbAPI()
test.storage(app_name='test_app',dir='')
test.run(host='127.0.0.1',port=5555)
Terminal
$ python3 run.py
Optimal Driver Code (Production)
run.py
test = BeardbAPI()
test.storage(app_name='test_app',dir='')
api = test.service()
Terminal
$ gunicorn run:api
API Documentation
API Endpoints
[POST] - \me
[POST] - \newuser
[POST] - \newproject
[POST] - \newdatabase
[POST] - \newbucket
[POST] - \insertdata
[POST] - \fetchdata
[POST] - \fetchbyid
[POST] - \updatebyid
[POST] - \updatedata
[POST] - \deletedata
[POST] - \deletebyid
[POST] - \getbuckets
[POST] - \getdatabases
[POST] - \getprojects
API QuickStart
To access any of the endpoint you have to include your email and secret in the body of the API Request.
{
"email":"teddyoweh@gmail.com"
"secret":"a60e1bb1be7fc59ea08378f2840a8a4f44c07d19b315c3e78a279660a3f8a6f5"
}
You can get you secret by creating a new user, steps to do so is listed in the API GUIDES Below All of the endpoints require only a POST Method
API GUIDES
- Create New User
- Get User Data
- Create Project
- Create Database
- Create Bucket
- Insert Data
- Update Data With Query
- Update Data With ID
- Fetch Data With Query
- Fetch Data With ID
- Delete Data With Query
- Delete Data With ID
- Get Projects
- Get Databases
- Get Buckets
Headers
Server: gunicorn
Date: Wed, 14 Dec 2022 08:11:34 GMT
Connection: close
Content-Type: application/json
Content-Length: 582
Access-Control-Allow-Origin: *
Create New User
Body
- fullname
- password
Method
POST
Endpoint
\newuser
Response
{
"status": "success"
"data": {
"email": "teddyoweh@gmail.com",
"fullname": "testt",
"id": "db067f2a-7ac4-11ed-aaf7-324d38bf6d76",
"password": "tstt",
"secretKey": "a60e1bb1be7fc59ea08378f2840a8a4f44c07d19b315c3e78a279660a3f8a6f5"
"databases": [
{
"name": "appp",
"project": "idea"
}
],
"projects": [
"idea"
],
"buckets": [
{
"database": "appp",
"modified": "2022-12-13 03:47:55.373527",
"name": "users",
"project": "idea"
},
]
"created": "2022-12-13 03:02:22.519349",
},
}
Get User Data
Body
- secret
Method
POST
Endpoint
\me
Response
{
"status": "success"
"data": {
"email": "teddyoweh@gmail.com",
"fullname": "testt",
"id": "db067f2a-7ac4-11ed-aaf7-324d38bf6d76",
"password": "tstt",
"secretKey": "a60e1bb1be7fc59ea08378f2840a8a4f44c07d19b315c3e78a279660a3f8a6f5"
"databases": [
{
"name": "appp",
"project": "idea"
}
],
"projects": [
"idea"
],
"buckets": [
{
"database": "appp",
"modified": "2022-12-13 03:47:55.373527",
"name": "users",
"project": "idea"
},
]
"created": "2022-12-13 03:02:22.519349",
},
}
Create Project
Body
- secret
- project
Method
POST
Endpoint
\newproject
Response
{
"status": "success"
}
Create Database
Body
- secret
- project
- database
Method
POST
Endpoint
\newdatabase
Response
{
"status": "success"
}
Create Bucket
Body
- secret
- project
- database
- bucket
Method
POST
Endpoint
\newbucket
Response
{
"status": "success"
}
Insert Data
Body
- secret
- project
- database
- bucket
- data
JSON FORMAT FOR Data
"{'name':'teddy'}"
Method
POST
Endpoint
\insertdata
Response
{
"status": "success"
}
Update Data With Query
Body
- secret
- project
- database
- bucket
- data
- query
JSON FORMAT FOR Data & Query
"{'name':'teddy'}"
Method
POST
Endpoint
\updatedata
Response
{
"status": "success"
}
Update Data With ID
Body
- secret
- project
- database
- bucket
- data
- id
JSON FORMAT FOR Data
"{'name':'teddy'}"
Method
POST
Endpoint
\updatedata
Response
{
"status": "success"
}
Fetch Data With Query
Body
- secret
- project
- database
- bucket
- query
JSON FORMAT FOR Query
"{'name':'teddy'}"
Method
POST
Endpoint
\updatedata
Response
{
"data": {
"id": "c0c5cc02-7ac8-11ed-a31f-324d38bf6d76",
"name": "teddy"
},
"status": "success"
}
Fetch Data With ID
Body
- secret
- project
- database
- bucket
- id
Method
POST
Endpoint
\fetchbyid
Response
{
"data": {
"id": "c0c5cc02-7ac8-11ed-a31f-324d38bf6d76",
"name": "teddy"
},
"status": "success"
}
Delete Data With Query
Body
- secret
- project
- database
- bucket
- query
JSON FORMAT FOR Data & Query
"{'name':'teddy'}"
Method
POST
Endpoint
\updatedata
Response
{
"status": "success"
}
Delete Data With ID
Body
- secret
- project
- database
- bucket
- id
Method
POST
Endpoint
\updatedata
Response
{
"status": "success"
}
Get Projects
Body
- secret
Method
POST
Endpoint
\getprojects
Response
{
"status": "success"
"data": {
"projects": [
"idea"
],
},
}
Get Databases
Body
- secret
Method
POST
Endpoint
\getdatabases
Response
{
"status": "success"
"data": {
"databases": [
{
"name": "appp",
"project": "idea"
}
],
},
}
Get Buckets
Body
- secret
Method
POST
Endpoint
\getbuckets
Response
{
"status": "success"
"data": {
"buckets": {
"database": "appp",
"modified": "2022-12-14 00:55:30.617538",
"name": "users",
"project": "idea"
},
},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.