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 eventsGET
/event/:event-id -- show eventGET
/event/new -- form to create new eventPOST
/event -- submit new event routeDELETE
/event/:event-id -- delete eventGET
/event/:event-id/edit -- form to edit eventPUT
/event/:event-id -- update event
- 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)
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 targetsinstall
,run
,test-unit
, andtest-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.
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.