@markstien/gitbase
Version:
基于Gitee API的键值操作封装
74 lines (45 loc) • 1.41 kB
Markdown
基于Gitee API的键值<del>数据库</del>操作nodejs封装.
* [先决条件](
* [安装](
* [使用](
* [License](
以下操作都基于[Gitee](https://gitee.com)
1. 创建一个用于存储的仓库
2. 设置->第三方应用->创建第三方应用

权限选择如下所示

3. 完成创建后,获取Client ID 和 Client Secret

```shell
npm i -S @markstien/gitbase
```
```ts
const main = async () => {
const gitBase = await GitBase({
account: "Gitee账户",
password: "Gitee密码",
clientId: "创建第三方应用获得的client id",
clientSecret: "创建第三方应用获得的client secret",
repoName: "用于存储的仓库,在第一步骤创建"
});
const addResult = await gitBase.add("GitBase");
console.log("添加结果",addResult);
const updateResult = await gitBase.update({
id: addResult,
value:"new value"
});
console.log("更新结果",updateResult);
//每一页100条记录
const listAllResult = await gitBase.listAll(1);
console.log(listAllResult)
}
main();
```
[](./LICENSE)