升级解析服务器2.x到3.x的是旧的代码库兼容

问题描述 投票:0回答:2

我们可以更新解析服务器2.8到3.x的我们的云代码库是使用主干风格效应初探回调。与新的3.x更新此兼容。具体来说3.1.2。

我们的代码库使用旧风格的成功,错误回调做,我们有我们的所有代码迁移到承诺或异步等待具体根据changelong

https://github.com/parse-community/parse-server/blob/master/CHANGELOG.md

node.js parse-platform
2个回答
1
投票

作为解析服务器3及以上版本,解析服务器使用解析JS SDK 2.0以上版本。

所以,你需要将所有的骨干样式之一:

  • 承诺
  • 异步/等待功能

例如:

new Parse.Query('your_class_name')
.find({
 success:function(result){}
});

应改为:

new Parse.Query('your_class_name')
.find()
.then((results)=>{})
.catch((error)=>{})

如果你是一个异步函数中,那么你可以这样做:

const asyncFunc = async() => {

  try {
    const results = await new Parse.Query('your_class_name').find();
    // do something with the results here.

  } catch (error) {
    // do something with the error
  }

}

0
投票

具有回购贡献者的代码有一个直接通话后迁移看见migration guide

© www.soinside.com 2019 - 2024. All rights reserved.