MEAN Stack – Prepare the Build Package for Deployment – Day 30

The MEAN Challenge Continues!

This video is part of the 30 Day MEAN Stack Honolulu Challenge

In this video we’ll prepare our mean.js app and get it ready to deploy!!

We look at:
– Using the Grunt Build command to create our application files
– Setting up a new MongoDB for production
– Hooking our new MongoDB instance in our production file
– Commit our file changes using Git

Woohoo now we’re ready to deploy!

6 Comments

Let me know what you think

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • SW
    Reply

    Hi, I’m ready to deploy my site to Heroku and wanted to know how to do so if not using Web-Storm. You mentioned it in Video 30 but I have not seen the instructions in earlier post’s.

  • steve
    Reply

    Hey thank you Shristi for the detailed reply and taking the time to provide a very clear example, really appreciate it, I will try modifying the existing CRUD query as suggested for starters. For role based logic I saw there’s a node acl module out there https://www.npmjs.org/package/acl and thought about using that for some of the application based role logic but still struggling really on how to incorporate that into the meanjs structure. But I will keep you updated if I make any progress though. Thanks again.

  • steve
    Reply

    Thank you for the webcast series Shristi, the energy and enthusiasm in which the webcasts were presented was amazing. I’m normally on my nth cup of coffee and battling to stay awake when watching webcasts from other paid tutorial sites but I managed to get through the entire series in two days and the hours literally just flew by , I really enjoyed it!

    I’m trying to add a new crud module but I want the items a user adds to only be viewable by that user or an admin level user. Do you think that would be doable with the MEANJS stack and could you give me some pointers on how to achieve that if so.
    Thank you again for the awesome series of posts.

    • bossable

      Hey Steve, thanks for checking out the videos! It’s great to hear that you enjoyed them too.

      There are a few different ways to show records to specific users. You mentioned the record creator, and admin, so you may also need to look into setting up user roles.

      I started writing out some pseudo-code but it looked too confusing. The key things I’d do:
      1. Have a look at $resource, and adding a custom query on the Angular side (make changes to the Controller and Service files).
      2. Look at calling a server route using $resource (within the Service, and the Server Route)
      3. Have a look into MongoDB queries.

      If you want to start slowly, maybe start with number 3 using the existing CRUD query in the server controller file for your CRUD module and change it up, just to see how it would work.
      Here’s an example to help you get started:

      exports.myItems = function(req, res) {

      var thisUser = mongoose.Types.ObjectId(req.param(‘userId’));

      Items
      .find({
      user: thisUser
      })
      .sort(‘-created’)
      .populate(‘user’, ‘displayName’)
      .exec(function(err, items) {
      if (err) {
      return res.status(400).send({
      message: errorHandler.getErrorMessage(err)
      });
      } else {
      res.jsonp(items);
      }