我正在使用新的Parse Server开发应用程序。我已经研究了很多,但无法弄清楚。我想运行一些服务器端代码(云代码),但我什至无法弄清楚如何使用Heroku和Mongo创建云代码文件。很感谢任何形式的帮助!
在应用程序的根目录中,创建一个云文件夹,并在该文件夹中创建一个main.js文件,然后将示例内容复制到该文件中
Parse.Cloud.define('hello', function(req, res) {
res.success('Hi');
});
然后在您的Index.js中在config中提到此文件的路径
var api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev',
cloud: __dirname + '/cloud/main.js',
appId: 'myAppId',
masterKey: '', //Add your master key here. Keep it secret!
serverURL: 'http://localhost:1337' // Don't forget to change to https if needed
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句