Skip to content

Instantly share code, notes, and snippets.

View mmetting's full-sized avatar

mmetting

View GitHub Profile
@mmetting
mmetting / example.html
Created June 21, 2017 15:51
Add another client side button to list all DB entries (Client App)
<ion-pane>
<ion-header-bar class="header-footer-bg">
<div class="center">
<h3>Feedhenry</h3>
<h4>Quickstart - Ionic</h4>
</div>
</ion-header-bar>
<ion-content has-header="true" ng-controller="MainCtrl">
<div class="row">
@mmetting
mmetting / controllers.js
Created June 21, 2017 15:50
Add another client side button to list all DB entries (Client App)
$scope.list = function () {
$scope.listMessage = "Calling Cloud Endpoint";
$scope.listTextClassName = "ion-loading-c";
fhcloud('/hello/list')
.then(function (response) {
if (response.msg != null && typeof (response.msg) !== 'undefined') {
$scope.listMessage = response.msg.msg.list;
$scope.listTextClassName = "ion-checkmark-round";
} else {
@mmetting
mmetting / hello.js
Created June 21, 2017 15:48
Add another client side button to list all DB entries (Cloud App)
var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');
var $fh = require('fh-mbaas-api');
function helloRoute() {
var hello = new express.Router();
hello.use(cors());
hello.use(bodyParser());
@mmetting
mmetting / hello.js
Created June 21, 2017 15:47
Add another client side button to list all DB entries (MBaaS Service)
var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');
var $fh = require('fh-mbaas-api');
function helloRoute() {
var hello = new express.Router();
hello.use(cors());
hello.use(bodyParser());
@mmetting
mmetting / hello.js
Created June 21, 2017 15:46
Only add unique Name values to DB (list)
var $fh = require('fh-mbaas-api');
var readOptions = {
"act": "list",
"type": "myFirstEntity",
"eq": {
"name": world
}
};
@mmetting
mmetting / hello.js
Created June 21, 2017 15:43
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
@mmetting
mmetting / hello.js
Last active June 21, 2017 15:42
Return DB response from service to cloud, and then from cloud to client (Cloud App)
var $fh = require('fh-mbaas-api');
$fh.service({
"guid": "jfi5oop5vbxmvfcfkef4qyyz",
"path": "/hello",
"method": "GET",
"params": {
"hello": world
},
"timeout": 25000
@mmetting
mmetting / hello.js
Created June 21, 2017 15:38
In cloud app, use $fh.service API to call service
var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');
var $fh = require('fh-mbaas-api');
function helloRoute() {
var hello = new express.Router();
hello.use(cors());
hello.use(bodyParser());
@mmetting
mmetting / hello.js
Last active June 21, 2017 15:37
Move DB logic from cloud app to Service
var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');
var $fh = require('fh-mbaas-api');
function helloRoute() {
var hello = new express.Router();
hello.use(cors());
hello.use(bodyParser());
@mmetting
mmetting / hello.js
Created June 21, 2017 15:33
Add a timestamp to each entry being inserted
var timestamp = new Date().getTime()
var options = {
"act": "create",
"type": "myFirstEntity",
"fields": {
"name": world,
"timestamp": timestamp
}
};