Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding MeteorJS to an existing AngularJS/MEAN stack app

I'm new to MeteorJS and I think it's a better alternative to the MEAN stack I used in one of my projects. I like the angular-meteor package (https://github.com/Urigo/angular-meteor) but I think it's mainly for adding AngularJS support to a MeteorJS app and not the other way around.

How would you approach adding MeteorJS to an existing AngularJS or MEAN stack app? I am thinking of creating a new MeteorJS app and install the angular-meteor package and then start importing my AngularJS modules from existing project. Is this the best approach? Can you share some tips or best practices?

like image 913
Rami Enbashi Avatar asked Sep 28 '22 22:09

Rami Enbashi


1 Answers

I think that for most use cases, it will be easier to create a new angular-meteor app and port your existing code into that:

  1. Create a new angular-meteor app
  2. Copy your existing Angular code into that app - still work with your old server with $http or whatever service you were using before
  3. Create the data schemes of your old server in the new Meteor server with Collection2 package.
  4. Convert your endpoints and node functions into Meteor methods (almost copy/paste with a few simple changes probably, but can be harder, depends on your implementation)
  5. Replace your Angular $http and communication services with angular-meteor's services

In most cases this would be radically simpler and I think it will be quicker than you think. When I did that to a simple MEAN stack app, the MEAN stack app took 532 Javascript lines and the angular-meteor app took 80 javascript lines, links to the code can be found here: http://info.meteor.com/blog/thoughts-on-angular-meteor-as-a-great-mean-stack

like image 169
Urigo Avatar answered Oct 20 '22 09:10

Urigo