Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cfsghost/courser
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Chien committed Aug 2, 2012
2 parents 5389b87 + b7b00e0 commit e10b191
Showing 1 changed file with 55 additions and 4 deletions.
59 changes: 55 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
courser
=======
=

Courser is a route manager for express web framework, provides an easy way to manage routes.

Installation
---
-

Using NPM to install Courser module directly:

npm install courser


Example
---
-

A small example of managing routes for express:

Expand Down Expand Up @@ -65,4 +65,55 @@ A small example of managing routes for express:


All of JavaScript files(*.js) in specific path will be loaded by Courser. Developer can add more APIs or pages to existing files or new file.


Example of Using Middleware:
-

module.exports = {
'/middleware': [
DoSomethingBeforeHandler,
middleware
]
};

function DoSomethingBeforeHandler(req, res, next) {

console.log('Do Something');

next();
};

function middleware(req, res) {

res.render('index', { title: 'Courser Example' });
};

Example of Specifying HTTP Method:
-

module.exports = {
'/method': {
get: get,
post: post
}
};

function get(req, res) {

res.end('GET Method');
};

function post(req, res) {

res.end('POST Method');
};

License
-

Licensed under the MIT License

Authors
-

Copyright&copy; 2012 Fred Chien <<fred@mandice.com>>

0 comments on commit e10b191

Please sign in to comment.