These codes are stored in separate file and I tried to call the get method from this file to another nodejs, but I am getting only [Function] as a out put.
Can any one tell me how to call the get method from this file to another node js file
'use strict';
var createAPIRequest = require('../../lib/apirequest');
function Fitness(options) {
var self = this;
this._options = options || {};
this.users = {
dataSources: {
get: function(params, callback) {
var parameters = {
options: {
url: 'https://www.googleapis.com/fitness/v1/users/{userId}/dataSources/{dataSourceId}',
method: 'GET'
},
params: params,
requiredParams: ['userId', 'dataSourceId'],
pathParams: ['dataSourceId', 'userId'],
context: self
};
return createAPIRequest(parameters, callback);
} } }; }
In this file you add
module.exports = Fitness
Then where you want to use it you do
var Fitness = require('./fitness');