Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

7 reasons to use Yeoman's angular-fullstack generator

DZone's Guide to

7 reasons to use Yeoman's angular-fullstack generator

· Web Dev Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

For my next project and, after looking for candidates and reading some hundreds of lines of documentation, I finally choose to work with the so called MEAN stack: mongodb, express, angular and node.

As with any other technology ecosystem, the great number of frameworks, libraries and tools can make our choice a challenge, and JavaScript is not an exception. But for JavaScript projects we have lot of help and I decide to use the awesome Yeoman tool. Yeoman combines the power of grunt, bower, npm and adds its own salt: the generators.

Yeoman generators are tasks responsible to build the initial project scaffolding.

Yeoman offers an extensive set of official generators oriented to create: webapps, backbone app, chrome extension, etc but we can also found a myriad of non oficial generators (yes, because anyone can create a new generator to satisfy his/her needs).

Within all the generators I chose angular-fullstack to create my MEAN project structure and next are my reasons:

1. Easy to install

You require to have node and npm installed on your system. Once you have them installYeoman and the angular-fullstack is as easy as:

$npm install-gyo
$npm install-ggenerator-angular-fullstack

Once installed the generator you simply need to create a new folder and initialise your project:

$mkdir my-new-project&&cd$_
$yo angular-fullstack[app-name]

2. Creates both client and server scaffoldings

The generator generates the full stack of your project, both the client and server code. Your project will start well organised and prepared to create an awesome RIA application.

3. Introduces good practices in the generated code

Because the generated is made by experienced developers, they applies good practices in code organisation and style programming (like the environment configuration on the server side using node).

For me, this is one of the most important reasons to use this generator. Anybody knows starting with a new technology is always hard, but it is nothing when you start with four new technologies :)

4. Server side API prepared to use authentication

Following best practices the code is prepared so you can easily add security to you API via a node middleware so each request requires authentication of the client side.

5. Support HTML or jade templating on client side

You can use any template engine for client side but by default the generator works with HTML and Jade. I don’t really like Jade too much so I always try to use EJS or similar (Warning this last sentence is the author’s opinion).

6. Support for different CSS preprocessors

For different opinions there are different alternatives. This way [a href="https://github.com/DaftMonk/generator-angular-fullstack"]angular-fullstack has support for plain CSS, Stylus, Sass or LESS pre-processors. Choose your preferred.

7. Commands to scaffold anything

With theangular-fullstack you can create new end points for the server side or client side components (like routes, controllers, services, filters, directives, …) with a sentences. So, next command:

yo angular-fullstack:endpoint message
[?]What will the url of your endpoint tobe?/api/messages

will produce:

server/api/message/index.js
server/api/message/message.spec.js
server/api/message/message.controller.js
server/api/message/message.model.js(optional)
server/api/message/message.socket.js(optional)

Conclusion

In my opnion, angular-fullstack is a really powerful tool that simplifies our day to day work.

As always it is not the panacea, it is simply a generic tool to automatize many common tasks. Because of this we can found situations it lacks some feature.

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda

Topics:

Published at DZone with permission of Antonio Santiago, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}