-
First of all run
npm update
-
Then run
bower install
-
Open a console window and run
nodemon
-
Open another console window and run
grunt
-
Navigate to localhost:3000 in your browser and enable live reload if you have it installed.
Grunt will watch for any changes to your stylus or javascript files and rebuild the css files automatically.
Nodemon will watch for any core file changes and will restart the server.
Enabling Live Reload in your browser takes care of refreshing.
.
├── bin // - holds the www or local file to start the app from
├── config // - config files
├── controllers // - controllers, see #controllers
├── models // - models, see #models
├── public // - all public facing files like css, javascript, images, icons, fonts, etc
├── routes // - routes, see #routes
└── views // - jade (if used) files, see #views
Note the naming convention.
controllers
├── admin.server.controller.js
├── entries.server.controller.js
├── index.server.controller.js
└── users.server.controller.js
These are included Mongo Mongoose Schemas.
models
├── entry.server.model.js
└── users.server.model.js
Route files hold the routes to actions, see below for an example.
routes
├── admin.js
├── core.js
├── index.js
└── users.js
Example route file
app.route('/register')
.get(users.register)
.post(users.createUser);
an example with middleware...
app.route('/entries')
.get(admin.isRequired, admin.entries);
Layout holds the overall html wrapper, error and index template is supplied.
The pages sub-directory can hold child directories also.
The partials sub-directory is for repeated blocks of code.
views
├── pages
├── partials
├── error.jade
├── index.jade
└── layout.jade