Show Table of Contents
Chapter 8. $fh.service
$fh.service(options, callback);
Call an endpoint in an MBaaS Service.
Minimum Requirements
- fh-mbaas-api : v4.9.1
8.1. Example
var $fh = require('fh-mbaas-api'); $fh.service({ "guid" : "0123456789abcdef01234567", // The 24 character unique id of the service "path": "/hello", //the path part of the url excluding the hostname - this will be added automatically "method": "POST", //all other HTTP methods are supported as well. for example, HEAD, DELETE, OPTIONS "params": { "hello": "world" }, //data to send to the server - same format for GET or POST "timeout": 25000, // timeout value specified in milliseconds. Default: 60000 (60s) "headers" : { // Custom headers to add to the request. These will be appended to the default headers. } }, function(err, body, res) { console.log('statuscode: ', res && res.statusCode); if ( err ) { // An error occurred during the call to the service. log some debugging information console.log('service call failed - err : ', err); } else { console.log('Got response from service - status body : ', res.statusCode, body); } });