Posts

Showing posts from February, 2015

MEAN js adding a CRUD module

Image
it's continuation of previous post.

Lets try to add  a new CRUD module to the app. First create a new module using the yo generator.


We will create a new module to add a company name and it's location.
yo meanjs:crud-module company It will ask some questions. Need to specify angular folders. Select all those. Next it will ask about menu. whether it need to be added or not. type 'Y' so it will create those links.


So the module is loaded. If you check the app folder you will find some new files in the app. Currently it had option to add the name only. We will add location also. Lets edit that. Navigate to model app/models/ and open company.server.model.js . This file consist the model of the module 'company'. This will define the mongoose schema . Lets add properties for this schema.


var mongoose = require('mongoose'), Schema = mongoose.Schema; var CompanySchema = new Schema({ name: { type: String, default: '', required: 'Please …