Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

jimpo/node-training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chronline Node.js Training Application

Project

The actual project is to create a calendar system on top of this basic application. You will want to create some sort of Event model and have some routes to submit events and view a listing of events or some sort of calendar view html. For example, you might consider the following routes to follow a somewhat RESTful architecture:

  • GET /event?view= -- show calendar of events
  • GET /event/:event-id -- show event
  • GET /event/new -- form to create new event
  • POST /event -- submit new event route
  • DELETE /event/:event-id -- delete event
  • GET /event/:event-id/edit -- form to edit event
  • PUT /event/:event-id -- update event

Getting Started

  • Get git
  • Install Node.js using nvm
  • Install npm: $ curl https://npmjs.org/install.sh | sh
  • Create a Github account
  • Add your public key to Github
  • Fork this repository
  • Clone the forked repository
  • $ make install
  • $ make run
  • Create the config.js file
  • Check your browser at http://localhost:4000 for the application
  • Start coding 8)

Application Architecture

  • server.js -- This file is the main executable that creates and starts the application. Keep it small.
  • config.js -- This stores the configuration variables. It should not be added to the repository.
  • lib/
  • route.js -- All application routing goes here.
  • helpers.js -- Helper functions defined here are available in the Jade template engine.
  • models/ -- All Mongoose models are defined in separate modules in this directory.
  • controllers/ -- Each controller should have a different resource.
  • util/ -- Utility functions.
  • `test/ -- Tests go in here. Tests are written with Mocha.
  • unit/
  • acceptance/
  • Makefile -- A Makefile with the targets install, run, test-unit, and test-acceptance.
  • package.json -- Node.js package file. List all npm dependencies here.

Testing, both acceptance and unit, is highly encouraged, but not required. It can definitely get annoying to write tests, but it is worth it.

Configuration

The config.js file should be filled out like so:

module.exports = {
    db: 'mongodb://username:pass@mongo.example.com:port/database',
    port: 4000,
};

You are free to add any configuration parameters you require.

Resources

About

Chronicle Node.js Training Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published