MeanIO and MeanJS - My Notes

I took some time to try MeanIO over the past few days. While I ended up coming back to MeanJS, I drew some conclusions that might be helpful.

Here's the use case. I wanted to take a GeoJSON file, load it into a boilerplate MEAN stack, generate CRUD files and get a basic app tested. Ideally, I'd want to tweak the layouts, menus, and boilerplate HTML as well as use bower to add js libs that add functionality.

I grabbed a copy of MeanIO and was able to use the CLI to create an app and package. I had come across learnmean.com and spent $15 on videos and an ebook. The content of which is a little light. The author provides overview level perspective in creating the Goals application, but we get very little code level discussion about how the model and controllers are put together. 

In MeanIO, running the mean package <packageName>, creates a directory in the packages/custom directory. This custom package directory is split into server and public directories which helps simplify - once you understand the relationship of the server and Express/Node to the public facing files AngularJS controller and HTML view files.

The MeanIO support approach suggests overriding, which is a key approach we see in Drupal theming. This is a strenght and the e-book I bought on learnmean.com has a short section on how to approach this in the MeanIO distribution. One challenge I had was in trying to adapt the boilerplate CRUD from the Articles public controller to fit my needs. Even as I went through a search and replace substituting mapitems for articles, I kept running into a js error when running this code in the public controller. My error indicated that this wasn't a valid constructor. 

 $scope.create = function(isValid) {
      if (isValid) {
        var mapitem = new Mapitems({
          title: this.title,
 
I ended up recreating my steps a few times in taking the Articles CRUD and overriding the boilerplate Mapitems CRUD and finally gave up and went back to MeanJS.
 
One thing that MeanJS has that MeanIO does not have is the ability to run the yo meanjs:crud <moduleName> command. This scaffolds out a module without having to copy/paste the CRUD views as is done in MeanIO (although they still need to be edited). This post is useful for understanding 
 
Anyway, I've still got to figure out overriding the layouts and HTML for my MeanJS version. I found the breakdown of the files in this IBM article really helpful if you're trying to figure out where to make changes. Here's another post that helps explain how backend and frontend work together in the MEAN stack.
 
In our next post, we'll actually put together some instructions on how to grab some GeoJSON, load it into a boilerplate MEAN instance, edit the model to work with the GeoJSON, generate CRUD and override some HTML to mock up how an app and dataset might work together.
 
 
 

Add new comment

By submitting this form, you accept the Mollom privacy policy.