# Parse JS SDK 使用示例

- 使用文档：https://docs.parseplatform.org/js/guide/
- API手册：https://parseplatform.org/Parse-SDK-JS/api/5.2.0/

# 安装依赖
``` bash
npm i -S parse
npm i -D @types/parse
```
配置 tsconfig.json
``` json
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
  }
```

# 设置微服务地址+参数

``` ts
// 引用Parse JS SDK
import Parse from "parse";
Parse.initialize("dev"); // 设置applicationId
Parse.serverURL = "http://web2023.fmode.cn:9999/parse"; // 设置serverURL

```

# 示例：最简单的列表加载

- pet.page.html
``` html
<ion-card *ngFor="let pet of petList">
    {{pet.get("name")}}
</ion-card>
```

- pet.page.ts
``` ts
ngOnInit() {
    this.loadPets()
  }
  
  petList:Array<Parse.Object> = []
  async loadPets(){
    let query = new Parse.Query("Pet");
    let list = await query.find();
    this.petList = list
  }
```
