1.3.1 • Published 6 years ago

node-ebaas v1.3.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

node-ebaas

ele baas node sdk

install

npm install node-ebaas

use

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

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

const DocModel = new Baas(APPID, TABLE);

let docs = await DocModel.find();

init

new Baas(APPID, TABLE, config);

configoptional

  • 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

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

使用例子:

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() 后生效

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago