An open API service indexing awesome lists of open source software.

https://github.com/easybase/easybasejs

Browser and Node.js compatible library for Easybase — used in easybase-react.
https://github.com/easybase/easybasejs

easybase

Last synced: 5 months ago
JSON representation

Browser and Node.js compatible library for Easybase — used in easybase-react.

Awesome Lists containing this project

README

          





Logo



npm
GitHub
npm bundle size
npm


## Table of Contents

* [About the Project](#about-the-project)
* [Built With](#built-with)
* [Getting Started](#getting-started)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Usage](#usage)
* [Documentation](#documentation)
* [Roadmap](#roadmap)
* [Contributing](#contributing)
* [License](#license)
* [Contact](#contact)

## About The Project

### Built With

* [microbundle](https://github.com/developit/microbundle)
* [webpack](https://webpack.js.org/)
* [cross-fetch](https://github.com/lquixada/cross-fetch)
* [Easybase.io](https://easybase.io)
* [object-observer](https://github.com/gullerya/object-observer)

## Getting Started
Browser and Node.js compatible library for Easybase **Projects** and **Node Integrations**. This project also serves as the core for [_easybase-react_](https://github.com/easybase/easybase-react).

### Prerequisites

* npm for node projects
* *There are no prerequisites for usage in browser*

### Installation
* Node:
```sh
npm install easybasejs
```
* Browser:
```html

...

...

```

## Usage

The node framework integration uses a query builder, [_EasyQB_](https://easybase.github.io/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](https://easybase.github.io/EasyQB/).

```javascript
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](https://easybase.io/react/).


### **Cloud Functions**

The *EasybaseProvider* pattern is not necessary for invoking cloud functions, only *callFunction* is needed.
```jsx
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](https://easybase.io/react/2021/03/09/The-Easiest-Way-To-Deploy-Cloud-Functions-for-your-React-Projects/).

## Documentation

Documentation for this library included in the `easybase-react` library [available here](https://easybase.io/docs/easybase-react/).

## Roadmap

See the [open issues](https://github.com/easybase/easybasejs/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**.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/EasybaseFeature`)
3. Commit your Changes (`git commit -m 'feature'`)
4. Push to the Branch (`git push origin feature/EasybaseFeature`)
5. Open a Pull Request

## License

Distributed under the MIT License. See `LICENSE` for more information.

## Contact

Your Name - [@easybase_io](https://twitter.com/easybase_io) - hello@easybase.io

Project Link: [https://github.com/easybase/easybasejs](https://github.com/easybase/easybasejs)