在开放源代码分析服务器上实现云代码

我正在开发一个应用程序使用新的分析服务器。 我已经研究了很多,但不能弄清楚。 我想运行一些服务器端代码(云代码),但我不知道如何使用Heroku和Mongo甚至创build一个云代码文件。 很感谢任何forms的帮助!

在应用程序的根目录下创build一个云文件夹,并在该文件夹中创build一个main.js文件,并复制文件中的示例内容

Parse.Cloud.define('hello', function(req, res) { res.success('Hi'); }); 

然后在你的Index.js中提到这个文件在config中的path

 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 });