0.1.1 • Published 10 years ago

generator-express-basic v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

generator-express-basic Build Status Coverage Status

Yeoman generator which creates a simple ExpressJS application and lets you decide what tools are included.

What is Yeoman?

Trick question. It's not a thing. It's this guy:

npm.io

Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.

Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.

$ npm install -g yo

Yeoman Generators

Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.

To install generator-express-basic from npm, run:

$ npm install -g generator-express-basic

Finally, initiate the generator:

$ yo express-basic

Getting To Know Yeoman

Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.

If you'd like to get to know Yeoman better and meet some of his friends, Grunt and Bower, check out the complete Getting Started Guide.

About this generator

Why yet another express generator ?

Most other Express JS generators are tailored for a specific case and therefore not very useful for others. They often include template libraries or directories for images... which clutter your project, and you either have to remove them manually or maintain something you don't need.

That's why this generator asks you what to include and doesn't make any assumptions. Reasonable defaults are provided.

As of now it is possible to setup the following tools (all optional):

  • Mocha (for testing)
  • Istanbul (for measuring code coverage)
  • Grunt (for automation)
  • Bower (for installing packages not available via npm)

Mocha support

If you decide to use Mocha for testing you will have mocha installed as a dev dependency in node_modules. You will also get an example test suite in tests.

To run this test suite please run: npm test in the root directory of your generated app. You should see something like this:

> test@0.0.1 test <path_to_your_generated_app>
> mocha


  ․

  1 passing (19ms)

Istanbul support

If you'd like to measure code coverage you can do so by enabling Istanbul. To get the coverage report you'll have to run npm test --coverage. This should give you a summary in your terminal, similar to this:

=============================== Coverage summary ===============================
Statements   : 100% ( 5/5 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 1/1 )
Lines        : 100% ( 5/5 )
================================================================================

You will also get an HTML report in coverage directory. You can open coverage/lcov-report/index.html in your browser to see the details.

Grunt

If you decide to use grunt a Gruntfile.js will be generated for you. It will have one (and default) task set up which runs your express aplication on localhost:3000.

Bower

If you like, you can use bower to set up packages which are not available in npm. If you choose to use it, a minimal bower.json file will be generated for you.

Running your application

To run you application it is best to install Grunt, after that you can just run grunt to have your application listen on localhost:3000.

License (MIT)

Copyright (C) 2014 Kamil Grymuza

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.