A test generator for Yeoman that will kick start a Node Application using Express.

Usage no npm install needed!

<script type="module">
  import generatorNodeExpresstesting from '';



A generator for Yeoman. Test project for node app based on

Getting Started

What is Yeoman?

From the default Yeoman Generator:

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.

To install Yeoman you will need to have npm (node packaged modules) installed. It comes with Node. You can install Node by using the downloader or through Brew. I like Brew. If you use Brew you'll need to add this to your .bash_profile.


Once Node is installed you'll have access to npm so you can use this to install Yeoman.

$ npm install -g yo

The -g means that you are installing Yeoman globally. If you wish to uninstall Yeoman you can do so with this command.

$ npm uninstall -g yo

What's included in this generator

This generator uses some tools I find useful. Those include:

  • Express.js
  • Express3-Handlebars for templating
  • Sass for styling
  • Javascript linting
  • It will open your project in your editor of choice
  • It will open your project in a browser of your choice
  • It will watch for changes to your files and recompile or restart the server if needed.
  • Uses LiveReload to refresh the browser when saving
  • It will build a production version of your app when you are ready to deploy
  • It comes ready to deploy to Heroku

Optional tools

Installing this generator

With Node and npm installed run this to install.

$ npm install -g generator-node-expresstesting

Using this generator

With the generator installed it is time to run it. Create a directory on your computer somewhere and cd into it via the terminal. Then run:

$ yo node-expresstesting

Yeoman will ask you some questions. Answer them and it will install stuff based on your answers.

Once Yeoman is done setting up your project run this command to start working on it.

$ grunt workon

This starts the server, launches the project in your editor, opens the project in a browser, and starts watching the project for changes.


To enable LiveRelaod you'll need to install the Chrome extension.

Live Reload Chrome extension

Once installed and the project is running just turn on the Chrome Extension.

Restarting the server

When you edit files that need the server to restart for you to see the changes, most of the time Grunt will just restart it for you. There are times when it gets stuck though. If this happens you can run this command to start it back up without reopening the project in your editor and browser.

$ grunt restart

Generate a production version of your app

Once your app is ready for production run this to generate a production build of your project.

$ grunt build

To test to see if the app is using the production version of the app you can shut down the server and start it again in production mode.

$ NODE_ENV=production node app.js

If it all works you are ready to deploy to Heroku. The Procfile at the root directory is for Heroku. Without it Heroku will choke. To deploy to Heroku you will need a Heorku account and the Heroku Toolbelt installed.

Once that is setup use Git to commit and then Heroku to create and deploy.

$ git init
$ git add .
$ git commit -m 'init'

Create the app

heroku create

Deploy your code

git push heroku master

To ensure that Heroku is setup to use your production settings you'll need to run this:

$ heroku config:set NODE_ENV=production

Open the project

heroku open

Things to do

  • Add test driven development.