0

From DiscoverMeteor pratice, Meteor Method is defined in collection folder, which is shared between client and server. The reason is to enable client latency simulation which would give instant effect without having to wait for server respond.

However in my case, I want to hide the detail of my Method implementation from the client. First, I don't feel comfortable sharing server logic to client. Second, the Method would be quite big.

In that case, where should I put Method definition? Server folder, I guess? If yes, then how my client get access to that Method?

Pahlevi Fikri Auliya
  • 4,157
  • 8
  • 35
  • 71

1 Answers1

2

Yes, you should put that method in server directory.

Meteor.methods({
  "methodName":function(){}
})

Usage:

Meteor.call("methodName", param1, param2, callback)

Description how to pass data returned from method to view is here: Iron Router: Pass data to client via meteor method

Community
  • 1
  • 1
Kuba Wyrobek
  • 5,273
  • 1
  • 24
  • 26