Skip to content

Instantly share code, notes, and snippets.

@bendavis78
Last active July 22, 2016 15:51
Show Gist options
  • Save bendavis78/0920f86fc3662b529d32ad906d824265 to your computer and use it in GitHub Desktop.
Save bendavis78/0920f86fc3662b529d32ad906d824265 to your computer and use it in GitHub Desktop.
Getting started with Express and Nunjucks in Cloud9

Installation

Start with the "Blank" cloud9 template. When it finishes loading, open up the terminal and install the yeoman and the express generator:

npm install -g yo generator-express

Then run the following command to generate the project files:

yo express

Select the "Basic" option, as well as the "Nunjucks" option for the view engine.

Running

Now you have a fully configured express application already. You can run it from the terminal using:

bin/www

Now if you click the Preview button in the top menu in the IDE, and choose "Preview with Web Server", this will open the Preview window for your running app.

Creating a Run Configuration

In order to make life easier you can create a run configuration for express.

  1. Click Run -> Run Configurations -> Manage ...
  2. Click Add New Config
  3. In the run panel fill in Express as name, bin/www as the command and Node 0.10.x as the runner.
  4. You can optionally make this run configuration the default runner by clicking Set As Default. If you do so then clicking the run button will always run the app and not the currently opened file.

The finished run configuration should look something like this:

express run config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment