Monday, 22 December 2014


1, install the generator by following this:

1.1 run mongodb locally

2, create a project by:
yo angular-fullstack [app-name]
3, create an end-point by:
yo angular-fullstack:endpoint message
it will generate an end-point at :/api/message

and it generate files below:
server/api/message/message.model.js  (optional)
server/api/message/message.socket.js (optional)
4, run grunt serve to run this project
  you can access your website by:http://localhost:9000/
  you can access your end-point by:http://localhost:9000/api/messages
  but you can only get an empty array

5, to init table of database, you need:
   edit : angular-fullstack-test/server/config/seed.js
   and add:

Message.find({}).remove(function() {
    name : 'yy Tools',
    info : 'Intyy cha, JSHint, Node Inspector, Livereload, Protractor, Jade, Stylus, Sass, CoffeeScript, and Less.'
  }, {

  simply copy the existing code and modify.

6, rerun the app, you will be able to see the data of your end-point

1 comment: