Why does console.log does not output in a publication?


#1

Hi,

Does anyone know why I don’t see anything in the server command window (so not the browser)?

thank you!

Meteor.publish('apps', function() {  
	console.log('publish the apps');
	var self = this;
	try {

		qrs.get('/qrs/app/full')
		.then(function(apps){
			_each(apps, function(app){
				self.added('apps', Random.id(), app);
			})
		})			
		self.ready();
	}
	catch(error) {
		console.log(error);
	}
});

#2

Are you actually subscribing to that publication?


#3

yes, I have this on the client. But I suspect that my whole server side publication code is not executed? ps, do you also know what .added means I can’t find anything on google for this.

in imports/ui

import { Template } from 'meteor/templating';
import { Customers } from '../api/customers.js';
import { Session } from 'meteor/session';
// import * from '/lib/globalHelpers.js';

import './body.html';
import './customer.js';
import moment from 'moment';
import lodash from 'lodash';

_ = lodash;

// set Session variable in method callback
Meteor.call('getApps', function(error, result){
  Session.set('qApps', result);
});

Meteor.call('getStreams', function(error, result){
  Session.set('qStreams', result);
  // console.log('de loaded apps from sense are: ', result);
});

Meteor.call('countApps', function(error, result){
  Session.set('countApps', result.value);
  console.log('count of apps:', result);
});

Meteor.call('countStreams', function(error, result){
  Session.set('countStreams', result.value);
});


//subscribe to the Sense apps publication, so that if Sense updates meteor will update too
Apps = new Mongo.Collection('apps');

Session.setDefault('searching', false);

Tracker.autorun(function() {  
  if (Session.get('apps')) {
    var searchHandle = Meteor.subscribe('apps');
    Session.set('searching', ! searchHandle.ready());
  }
});

#4

PS, i am trying to get data from an external REST api, using meteor I want to CRUD things on that server. I use this manual http://meteorcapture.com/publishing-data-from-an-external-api/


#5

also, I would like to log the object I get back from the API, but I use to get memory exceeded errors, do you maybe have some best practices for that or do I just have to make the resultset smaller?

thanks