Extract Livequery, DDP & MiniMongo

Hello Meteor!

I’ve been exploring Meteor for the past weeks and I love it. Thank you so much for the effort you put into it!

I’m working on an app that was started an AngularJS app - using IonicFramework. I would like to benefit from Meteor’s data sync features but I wouldn’t bother rewriting the whole app using Blaze.

How can I extract the 3 packages that provide this functionality in a separate server? How can I use Meteor just as a server while still benefiting from MiniMongo on the client?

I’ve seen attempts like Asteroid, but it lacks functionality. You don’t have complex queries like Livequery and you don’t have MiniMongo.

Any help would be much appreciated!

Thanks,
Andrei

Create a dummy app and remove all the standard packages. Then add packages you need. Then run meteor build and extract the compiled files for browsers.

2 Likes

Slava, I created an app and when I run meteor list I see only three packages

  • autopublish
  • insecure
  • meteor-platform

I suppose meteor-platform has all the goodies in it. How can I know exactly what packages do I need for the DB and Data Sync?

You can run meteor show meteor-platform to explore its contents and dependencies.

The package with mongo-related stuff is in mongo.

I added the packages that were necessary for the DB but I get this error: Program has no main() function.

After adding the webapp package it works again, but I don’t want to add it since it has dependencies like blaze and template.

Is there any way to solve this differently?

There’s some good info in this tutorial about removing the standard packages, putting back the necessary packages and dealing with the main function:

http://practicalmeteor.com/writing-command-line-programs-with-meteor/

I added this javascript code and it seems to work.

Meteor.methods({
  test: function() {
    console.log('it works');
  }
});

main = function(argv) {
  console.log('started');
  return 'DAEMON';
};

Now I have another issue. In my client I try to connect through DDP to the “server” like this:

<script>
  var ddp = 'http://localhost:3030/';
  __meteor_runtime_config__ = { 'DDP_DEFAULT_CONNECTION_URL': ddp };
</script>
<!-- this is the code I got from `meteor build` -->
<script src="meteor-client.js"></script>
<script>
  Meteor.call('test');
</script>

Unfortunately it doesn’t log anything to the console and I’m not sure how to debug it.

@deiucanta You could also keep your Angular front-end and just connect to your Meteor back-end with https://github.com/mondora/asteroid

@gwendall Asteroid doesn’t provide everything that minimongo provides. Also, it doesn’t allow for complex live queries.

I’m trying to do the same thing by decoupling the official packages.

Adding webapp makes the code above functional. However, I don’t like the dependencies webapp brings.

Looking through the code for the webapp package, I couldn’t understand how it relates to DDP? Why adding it makes DPP work as expected? How can I replicate that part and not use webapp

Hi @deiucanta, did you find a solution in this matter?

http://angular-meteor.com/

Hi @magnus, yes I found a solution I didn’t use it eventually

  1. Setup a new meteor project
  2. When you view the source of the index in browser you will see all the included scripts
  3. You can copy them from the hidden .meteor folder inside a separate project
  4. Also you can copy the html source from the browser
  5. Remove scripts one by one until you achieve the minimum set of packages/scripts which give you full support for DDP and Minimongo.

Hope it helps!