Skip to content

Getting Started

Ah-dri-Anna edited this page Oct 23, 2018 · 2 revisions

Install Node

$ brew install node or directly from the node website

Install Express

$ npm install express --save

Initial Environment Setup

$ cd directory/of/git/repo
$ npm init # follow instructions
$ npm install express --save
$ npm install express-generator -g # scafolding
$ express --view=pug website # pug templating engine (the new jade)
$ cd website
$ npm install
$ npm start
The project can be found at http://localhost:3000
A link to the setup guide can be found here here

Directory Structure of Express

.
├── app.js
├── bin
│   └── www
├── package.json
├── public
│   ├── images
│   ├── javascripts
│   └── stylesheets
│       └── style.css
├── routes
│   ├── index.js
│   └── users.js
└── views
    ├── error.pug
    ├── index.pug
    └── layout.pug

7 directories, 9 files

Running the Project Locally

$ cd into/git/repo/../website
$ npm start or
$ DEBUG=website:* npm start # to debug

Help

If your new to node, hopefully the following clarifies a few things for you. Running npm start will call our app.js file located in the website project directory. This file will then make the calls to the different MVC components. The views are located in \views. The index.html is instead called index.pug and uses the pug templating engine to render the view.