Table of Contents
About The Project
Built With
Getting Started
Browser and Node.js compatible library for Easybase Projects and Node Integrations. This project also serves as the core for easybase-react.
Prerequisites
- npm for node projects
- There are no prerequisites for usage in browser
Installation
- Node:
npm install easybasejs
- Browser:
<head>
...
<script src="https://cdn.jsdelivr.net/npm/easybasejs/dist/bundle.js"></script>
...
</head>
Usage
The node framework integration uses a query builder, EasyQB, to execute CRUD operations.
The db()
function will point to your database. Execute queries with .all
and .one
. Read the documentation for .db
here.
import Easybase from "easybasejs";
import ebconfig from "./ebconfig"; // Download from Easybase.io
// Initialize
const table = Easybase.EasybaseProvider({ ebconfig }).db();
const { e } = table; // Expressions
// Delete 1 record where 'app name' equals 'MyAppRecord'
await table.delete.where(e.eq('app name', 'MyAppRecord')).one();
// Basic select example 'rating' is greater than 15, limited to 10 records.
const records = await table.return().where(e.gt('rating', 15)).limit(10).all();
console.log(records);
A detailed walkthrough of using serverless database is available here.
Cloud Functions
The EasybaseProvider pattern is not necessary for invoking cloud functions, only callFunction is needed.
import { callFunction } from 'easybase-react';
function App() {
async function handleButtonClick() {
const response = await callFunction("123456-YOUR-ROUTE", {
hello: "world",
message: "Find me in event.body"
});
console.log("Cloud function: " + response);
}
//...
}
Learn more about deploying cloud functions here.
Documentation
Documentation for this library included in the easybase-react
library available here.
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/EasybaseFeature
) - Commit your Changes (
git commit -m 'feature'
) - Push to the Branch (
git push origin feature/EasybaseFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Your Name - @easybase_io - hello@easybase.io
Project Link: https://github.com/easybase/easybasejs