Services

Reusable Cloud Instances

Services

  • Accessible from multiple projects
  • Promote code reuse
  • Work similar to Cloud Apps (Node.js)
  • Enables separation of concerns
  • Provide an easy to use API ($fh.service)
  • Improve and speed up development
  • Not linked to any specific Project

Service Structure

Cloud App

Service

$fh.cloud

$fh.service

The Value of Services #1

  • 7 of your apps rely on Twilio API
  • All 7 use the Twilio Service
  • Twilio updates their API; it's a breaking change!
  • You only update Twilio Service to fix all 7 apps!

The Value of Services #2

  • Enable better collaboration
  • Developer A works on a Service
  • Developer B works on the App
  • Developer A provides Service Documentation
  • Developer B uses this to call service functions

Service Templates

  • Sendgrid API (Email)
  • Twilio API (SMS)
  • PayPal API
  • Salesforce
  • Amazon SES
  • Amazon SQS
  • Google APIs
  • MS Sharepoint
  • ...and more

Service Templates

Service Documentation (.MD)

Generated Code Snippet

Calling Services

$fh.service

Create a Project

 

Create a Cloud App within

 

Use $fh.service!

$fh.service

  • Part of the fh-mbaas-api Node.js module
  • Follows standard Node.js API conventions
  • Expects options object and callback function

Calling a Service


'use strict';

var $fh = require('fh-mbaas-api');


function serviceCallback (err, data) {
  if (err) {
    return console.log(err);
  }
  return console.log(data);
}

$fh.service({
  guid: "SERVICE_ID",
  endpoint: "addUser",
  params: {
    "name": "Evan",
    "age": "24"
  }
}, serviceCallback);

Service ID

Let's do it from scratch

Create a Bare Project

Add a Cloud App

Cloud App Added

Provision a Sendgrid Service

Configure & Create Service

Associate Service with Project

Get a Service Snippet (Discover)

Update our Cloud App

FeedHenry Services

By Evan Shortiss

FeedHenry Services

An introduction to FeedHenry Services

  • 971