Create a vertical MEAN.js 0.4 crud module

In this video we’ll create a vertical module for MEAN.js 0.4 using the yeoman meanjs generator!

yo meanjs:vertical-module customer

Category: Mean Stack
Tags:

13 Comments

Let me know what you think

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

  • Krishna
    Reply

    Getting Error : Can’t set headers after they are sent.

    Hi,

    Thank you very much for MEAN Videos, Very useful to understand Mean project..

    I need some help one issues. I am facing one error “Can’t set headers after they are sent.”

    This is my Code:

    app.route(‘/’)
    .get(categorys.list)
    exports.list = function(req, res) {
    Category.find().exec(function (err, categorys) {
    if (err) {
    return res.status(400).send({
    message: errorHandler.getErrorMessage(err)
    });
    } else {
    res.render(‘index’, {
    user: req.user || null,
    request: req
    });

    res.json(categorys);
    }
    ;
    });
    }

    I want sent Categorys data as response but i am geeting mentioned error.
    Note:- I dont want send categorys as user( user: req.user || null,) in response.
    Thank you very much for your help.
    Regards,
    Krishna

    • bossable

      Hey Krishna,

      You actually have 3 responses in your code, so by the time the last one is reached (res.json(categorys), the response has already been sent.

  • Pedro
    Reply

    npm install meanjs/generator-meanjs#0.4-dev

    doesn’t seem to be working anymore. Is there another way to get the generator?
    I know you recommend just cloning the git repo, and that’s fine and good for a start. But what happens when I want to create my own modules? I definitely would like to have a generator available for that

  • yada
    Reply

    some how somewhere down the line I got it fixed not sure what the change was
    thanks again! I am on MEAN Stack 9: GREAT JOB THANK YOU!

    • yada

      oh sorry taking up so much space I THINK the fault was that I did not have the yeoman mean js generator installed globally with sudo npm install -g meanjs etc.. hope this helps somebody

  • yada
    Reply

    Do you know of a work around for this error? The videos have been very helpful learning the MEAN.js stack thank you!

    /projects/mean# yo meanjs:crud-module customer
    Error meanjs:crud-module customer

    You don’t seem to have a generator with the name meanjs:crud-module installed.
    You can see available generators with npm search yeoman-generator and then install them with npm install [name].
    To see the 0 registered generators run yo with the `–help` option.

    • bossable

      For the sub generators – Yes, however, it’s probably not the best way to create a new meanjs project. For a new 0.4.0 project, I’d suggest cloning directly from the source.

  • person ablach
    Reply

    Hello Schisti, First let me thank you for your 30-day challenge. You are an exceptionally talented individual not just for your programming knowledge but also for your innate teaching ability. There is a certain generosity to your explanations. Simply put this kind of resource was not accessible to me for other languages which I passed by as a first time developer. I’m stoked

    That said I think it would compliment the foundation of the 30-day challenge and this vertical module to show how you can begin to work with a layer of complexity between two (or more) modules.

    In my project for example:

    I wish to produce a /slug url request that brings up any given {{user}} and their {{customers}}
    (just to use the 30-day example you’ve already built up.)

    • bossable

      Thank you! I appreciate your kind feedback! 🙂

      I have a list of ‘upcoming videos to make’ and I’ll add your idea to the list. Communicating between modules can get tricky, and I can show you some simple ways to get around it using Services and Directives.