parse.com - In cloud code seems impossible to use Parse.Config.get() with express is it correct? -
is there way use parse.config.get() inside expressjs app hosted in cloud code?
looks easy use parse.object , parse.user parse.config.get() code not deployed using "parse deploy"
we manage use adding jssdk in html , using "frontend js" haven't find way use in directly in express controllers.
thanks
it seem related kind of permissions issues...
var parse = require('parse-cloud-express').parse; var util = require('util') parse.cloud.define("currentconfig", function(request, response) { console.log('ran currentconfig cloud function.'); // why have this? parse.initialize(xxx, yyy); parse.config.get().then(function(config) { // never called // ... console.log(config.get('xxx')) }, function(error) { console.log(util.inspect(error)) }); });
output
ran currentconfig cloud function. { code: undefined, message: 'unauthorized' }
edited code work me:
var parse = require('parse-cloud-express').parse; var util = require('util') parse.initialize("appid", "restapikey", "masterkey"); parse.cloud.define("currentconfig", function(request, response) { console.log('ran currentconfig cloud function.'); parse.cloud.usemasterkey(); parse.config.get().then(function(config) { // never called // ... console.log(config.get('xxx')) }, function(error) { console.log(util.inspect(error)) }); });
edit: add solution :)
Comments
Post a Comment