Skip to content

Instantly share code, notes, and snippets.

@mmetting
Created June 21, 2017 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmetting/a2051740df4424d55862222ad72eb8d9 to your computer and use it in GitHub Desktop.
Save mmetting/a2051740df4424d55862222ad72eb8d9 to your computer and use it in GitHub Desktop.
Return DB response from service to cloud, and then from cloud to client (MBaaS Service)
var $fh = require('fh-mbaas-api');
var timestamp = new Date().getTime();
var options = {
"act": "create",
"type": "myFirstEntity",
"fields": {
"name": world,
"timestamp": timestamp
}
};
$fh.db(options, function (err, data) {
if (err) {
console.error("Error " + err);
res.status(500).json({ msg: err })
} else {
console.log(JSON.stringify(data));
res.status(200).json({ msg: data })
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment