Platform
自定义解析选项
18 分
介绍 在本指南中,您将学习如何添加和编辑自定义解析选项。 目标 配置解析服务器选项。 先决条件 阅读或编辑此页面没有先决条件。 解析服务器选项 当您在back4app创建新应用程序时,我们将创建您所有的应用程序后端结构,并构建您的数据库结构、应用程序层和api。我们考虑到可扩展性和安全性,完成所有工作。 在您的应用程序创建时,将生成一个名为config json的文件,其中包含以json格式启动应用程序的配置选项,如密钥。 这个块看起来像这样: 如何使用它? 现在,我们将向您展示一些可以在此部分轻松更改的属性示例。 请注意,这里是一个 危险区域 。如果您做错了什么,您的应用程序可能会停止工作。如果您不确定,请寻求支持。 请查看以下关于如何使用每个属性的主题: 属性:allowcustomobjectid 启用(或禁用)自定义objectid。 { "allowcustomobjectid" true } 属性:custompages 通过此属性,您将能够添加用于密码验证和重置的自定义页面。 1 启用您的网络托管 您需要采取的第一步是按照 此指南 https //www back4app com/docs/platform/parse web hosting 启用您的网络托管。 2 上传html文件 在此步骤中,您只需将这些静态html页面部署到云代码的“public”文件夹中。请下载以下模板以进行编辑: 在上传这些文件之前,请确保您的文件名中没有空格。 3 配置自定义页面 配置将如下所示: 示例 { "custompages" { "invalidlink" "https //\<subdomain> b4a app/invalid link html", "verifyemailsuccess" "https //\<subdomain> b4a app/verify email success html", "choosepassword" "https //\<subdomain> b4a app/choose password html", "passwordresetsuccess" "https //\<subdomain> b4a app/password reset success html", "invalidverificationlink" "https //\<subdomain> b4a app/invalid verification link html", "linksendfail" "https //\<subdomain> b4a app/link send fail html", "linksendsuccess" "https //\<subdomain> b4a app/link send success html" } } 查看如何 在这里创建您的子域名 https //www back4app com/docs/platform/activating web hosting 属性 sessionlength 此属性配置您的会话的过期时间,以秒为单位(默认为1年)。 示例 { "sessionlength" 31622400 } 属性 emailverifytokenvalidityduration 此属性配置电子邮件验证令牌的有效期,以秒为单位。 示例 { "emailverifytokenvalidityduration" number } 属性 enableanonymoususers 通过此属性,您将能够启用(或禁用)匿名用户,默认为true。 示例 { "enableanonymoususers" false } 属性 enablesingleschemacache 使用一个在请求之间共享的单一模式缓存。减少对 schem的查询次数,默认为false,即每个请求唯一的模式缓存。 示例 { "enablesingleschemacache" true } 属性 expireinactivesessions 设置是否应过期未活动的会话,默认为 true。 示例 { "expireinactivesessions" false } 属性 objectidsize 设置生成对象 id 的字符数,默认为 10。 示例 { "objectidsize" number } 属性 preservefilename 启用(或禁用)向文件名添加唯一哈希。 请注意,建议将其保持为 false,以防在尝试删除未使用的文件时出现错误! 示例 { "preservefilename" boolean } 结论 到此为止,您已经学习了如何自定义您的 parse server 选项。