Using DDP.connect
This can be done on the server or the client. If you want to make calls to it directly from the browser put it on the client, if you prefer from the server for more security put it there, if you want to handle both, put it in code that is processed by both client/server.
Make sure the connection is global so that you can use it anywhere. Something like this I imagine:
const remoteApp = DDP.connect(url);
export { remoteApp };
Then call as you would normally with Meteor.
remoteApp.call("method_name",{ _id : "an_id"},function(err,result){
if(err){
// Handle the error
}else{
// Work with the result
}
});
The docs for DDP.connect say that you can use:
- subscribe
- call
- apply
- methods
etc.
They don’t mention callAsync
, but you can try that as well and see what happens.
Sharing A Database
The quickest method with the least coding is to share a database. Locally you can run your two apps with the following process:
Sharing Locally
// Open two terminal tabs, one on Admin app directory, one on Consumer app directory
// Meteor sets its local mongodb instance on the next sequential port, so if app is running
//on port 3000 its mongodb is running on port 3001
// Run the Admin app first
meteor run --port 3000 --settings settings.json
// Hop over to the Consumer app terminal tab
export MONGO_URL=mongodb://localhost:3001/meteor
meteor run --port 3002 --settings settings.json
If you do it this way remember that which ever app ‘owns’ the database, if you shut it down the database will shut down, so the second app will start throwing Mongo connection errors.
Sharing on Galaxy
//Deploy Admin app with free mongo instance
DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy [appname] --settings settings.json --owner [organisation-name] --mongo
// You will get back a MONGO_URL in the CLI that looks something like this
//mongodb://****:**********.servers.mongodirector.com:27017,SG-eugalaxycluster-38732.servers.mongodirector.com:27017/*****?replicaSet=RS-eugalaxycluster-0&ssl=true.
// Open your settings.json file for your Consumer app and add the following
{
"galaxy.meteor.com": {
env: {
MONGO_URL: "The Mongo URL you got back from Admin app deploy"
}
}
}
// Hop over to the Consumer app terminal tab
// Deploy the consumer app
// Don't include a free mongo instance with this deploy
DEPLOY_HOSTNAME=eu-west-1.galaxy.meteor.com meteor deploy [appname] --settings settings.json --owner [organisation-name]
Using a REST API
Although it’s a very old package I like to use simple:json-routes, because it’s simple 
Hope that helps