# node-ebaas

> ele baas node sdk

Latest version **1.3.1** (published 2018-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-ebaas
pnpm add node-ebaas
yarn add node-ebaas
bun add node-ebaas
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2018-01-08 |
| First published | 2017-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | junjian.zheng@ele.me |
| Maintainers | antsword, geemo, lellansin |

## Links

- npm: https://www.npmjs.com/package/node-ebaas
- npm.io page: https://npm.io/package/node-ebaas

## Dependencies (7)

- [kitx](https://npm.io/package/kitx.md) ^1.2.1
- [debug](https://npm.io/package/debug.md) ^2.6.8
- [httpx](https://npm.io/package/httpx.md) ^2.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [deep-equal](https://npm.io/package/deep-equal.md) ^1.0.1
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.23.0
- [lodash.clonedeep](https://npm.io/package/lodash.clonedeep.md) ^4.5.0

## Recent versions

- 1.3.1 (latest) — 2018-01-08
- 1.3.0 — 2017-11-20
- 1.2.0 — 2017-09-26
- 1.1.4 — 2017-09-14
- 1.1.3 — 2017-08-11
- 1.1.2 — 2017-08-11
- 1.1.1 — 2017-08-11
- 1.1.0 — 2017-08-11
- 1.0.4 — 2017-07-07
- 1.0.3 — 2017-07-06
- 1.0.2 — 2017-07-05
- 1.0.1 — 2017-07-05
- 1.0.0 — 2017-07-05

## README

# node-ebaas

ele baas node sdk

## install

npm install node-ebaas

## use

``` javascript
const Baas = require('node-ebaas');

const APPID = '59192c5984a2fc6c74675dbd';
const TABLE = 'docs';

const DocModel = new Baas(APPID, TABLE);

let docs = await DocModel.find();

```

### init

``` javascript

new Baas(APPID, TABLE, config);

```

#### config[optional]

- env(string) alpha/alta/altb/production (default: production)

- secue(boolean) https 或者 http (default: true)

- debug(boolean) (default: false)

- host(string) custom host, example: baas.ele.me (default: null)

## method

所有函数最后一个参数可以传递 headers

```javascript
find(query) -> find(query, headers)
```

使用例子:

```javascript
const AppModel = new Baas(APPID, TABLE, config);

const headers = {
  Cookie: 'COFFEE_TOKEN=[YOU_COFFEE_TOKEN]'
};

await AppModel.find(null, headers);
```

注意，这里因为 find 的第一个参数是 queryObject，所以为了保证 headers 是在最后一个参数，第一个参数不能省略

### Model

#### find(query)

  查询

#### count(query)

  计数

#### findById(_id)

  根据 _id 查询

#### create(body)

  创建

#### update(_id, body)

  更新

#### remove(_id)

  删除

### Instance

#### save()

  更新保存

#### update(body)

  更新保存

#### detroy()

  删除

#### inc(key, value)

  增减操作，save() 后生效

---
_Source: https://npm.io/package/node-ebaas · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
