RC with meteor:REST


#1

I want to test methods and publications of RC with rest requests through simple:rest, but
"ReferenceError: SimpleRest is not defined" occurred when i attempt call SimpleRest method in RC code, though simple:rest has already been correctly installed and GET requests to publications are normally,
please, what is wrong?
correct way to do this?


#2

SimpleRest is a server-only method. Are you possibly running it on the client?


#3

If all you’re doing is testing methods and publications, you can also use the native DDP interface…

Methods
in your browser console:

Meteor.call('methodName', methodOptions, function(error, result) {
  console.log(error);
  console.log(result);
});

Subscriptions
You can use the Meteor Dev Tools for Chrome to analyze subscription (and method) traffic.

Or for testing all of the above and a lot more, you could use something like Meteor Toys.


#4

thank for useful info about DDP and tools…

i want transfer product catalog from Google Sheet through http simple:rest.
But methods.js from reaction-catalog/server/ don’t sees SimpleRest,
i do include
import { SimpleRest } from ‘meteor/simple:rest’;
now "Cannot read property ‘SimpleRest’ of undefined"
some sort of error in importing?
i don’t find “simple:rest” package in ./meteor/packages, to see exports,
can you help?


#5

@orloff Doesn’t look like you’d need to import SimpleRest. You should just be able to use SimpleRest as a global.


#6

through api.use() ?
i did, error disappears