码迷,mamicode.com
首页 > Web开发 > 详细

用MeanJS和Yeoman生成器生成【翻译】

时间:2015-03-19 16:07:46      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

One of my favorite things with Yii is the Gii (Generator).

关于Yii(php框架)我喜爱的事情之一是Gii(生成器)Global Information Infrastructure。

 

With a few clicks I could simply add a few Models/Controllers/Views (or all of the above), then build/customize those.

我只需要点击几次就可以添加一些模型/控制器/视图(或者这三个一起),然后就可以构建/定制他们了。

 

MeanJS uses the Yeoman/Yo generator to make this happen. After installing Yeoman generator (which I believe we already installed when we installed MeanJS) via:

 MeanJS 使用Yeoman/Yo生成器让这个变为可能。安装了Yeoman生成器之后(我相信在我们安装MeanJs的时候我们已经安装了) 通过:

npm install -g yo
Now to install the MeanJS generator package:
现在开始安装MeanJs生成器的包:
npm install -g generator-meanjs

(remember, often when running npm install -g you’ll need to sudo it)

(记住,当执行npm install -g 命令的时候,经常你需要用sudo提升权限来执行(linux里的命令))

Basic CRUD

基本的增读改删

For those who are not familiar with the concept, CRUD stands for – Create, Read, Update & Delete.

 

These are the basics one needs to present & manipulate data on a website, and a lot of web frameworks generate CRUDs as sort of a first-step.

Let’s create our first CRUD:

yo meanjs:crud-module firstmodule

After selecting the supplemental folder to include in the Angular Module, and whether or not the module should be added to the menu, a bunch of files are generated.

Very Important: The crud-module generates both the Server side & Client files.

The Module Structure was explained thoroughly onBasics of MeanJS.

The crud-module is the all encompassing, there are also sub generators:

  • angular-module
  • angular-route
  • angular-controller
  • angular-view
  • angular-service
  • angular-directive
  • angular-filter
  • angular-config
  • angular-test
  • express-model
  • express-controller
  • express-route
  • express-test

Those names are pretty self explanatory, so I don’t see much need to go deeper there.

More information about Yeoman generator specifically used for MeanJS can be foundhere

As you can probably notice, this article came out a bit shorter than expected, this is mainly due to time constraints.

I’d like to continue and develop under MeanJS, as I see a lot of interest on the subject.

There are also a few other frameworks that I started reading about that might be a part of some future articles (some are fairly similar).

Bonus info: MeanJS was on the Changelog podcast! , very cool.

用MeanJS和Yeoman生成器生成【翻译】

标签:

原文地址:http://www.cnblogs.com/yangzhx/p/4350648.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!