Skip to content

Instantly share code, notes, and snippets.

Avatar

mmetting

View GitHub Profile
@mmetting
mmetting / example.html
Created Jun 21, 2017
Add another client side button to list all DB entries (Client App)
View example.html
<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 Jun 21, 2017
Add another client side button to list all DB entries (Client App)
View controllers.js
$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 Jun 21, 2017
Add another client side button to list all DB entries (Cloud App)
View hello.js
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 Jun 21, 2017
Add another client side button to list all DB entries (MBaaS Service)
View hello.js
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 Jun 21, 2017
Only add unique Name values to DB (list)
View hello.js
var $fh = require('fh-mbaas-api');
var readOptions = {
"act": "list",
"type": "myFirstEntity",
"eq": {
"name": world
}
};
@mmetting
mmetting / hello.js
Created Jun 21, 2017
Return DB response from service to cloud, and then from cloud to client (MBaaS Service)
View hello.js
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 Jun 21, 2017
Return DB response from service to cloud, and then from cloud to client (Cloud App)
View hello.js
var $fh = require('fh-mbaas-api');
$fh.service({
"guid": "jfi5oop5vbxmvfcfkef4qyyz",
"path": "/hello",
"method": "GET",
"params": {
"hello": world
},
"timeout": 25000
@mmetting
mmetting / hello.js
Created Jun 21, 2017
In cloud app, use $fh.service API to call service
View hello.js
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 Jun 21, 2017
Move DB logic from cloud app to Service
View hello.js
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 Jun 21, 2017
Add a timestamp to each entry being inserted
View hello.js
var timestamp = new Date().getTime()
var options = {
"act": "create",
"type": "myFirstEntity",
"fields": {
"name": world,
"timestamp": timestamp
}
};