Permalink
Browse files

markdown testing

  • Loading branch information...
1 parent ca5d53d commit f2fe2ad9f7f38a53344c9b516d0ec1dfc07c263a @rafalio committed Jul 26, 2011
Showing with 25 additions and 25 deletions.
  1. +25 −25 README.markdown
View
50 README.markdown
@@ -1,39 +1,39 @@
-## Very simple router for node.js
+#ARouter
+###Very simple router for node.js
This allows me to define my routes in the following way:
<pre>
-
- home = function(req,res){
- res.render('index.jade');
- }
-
- edit = function(req,res){
- res.render('edit.jade');
- }
-
- requireLogin = function(req,res,next){
- if(req.session.user) next();
- else res.redirect('/');
- }
-
- edit_p = function(req,res){
- // posting to a page
- }
+home = function(req,res){
+ res.render('index.jade');
+}
+
+edit = function(req,res){
+ res.render('edit.jade');
+}
+
+requireLogin = function(req,res,next){
+ if(req.session.user) next();
+ else res.redirect('/');
+}
+
+edit_p = function(req,res){
+ // posting to a page
+}
routes =
- get:
- '/': [home]
- '/edit': [requireLogin,edit]
- post:
- '/edit' : [edit_p]
+ get:
+ '/': [home]
+ '/edit': [requireLogin,edit]
+ post:
+ '/edit' : [edit_p]
</pre>
and then use them in it in the following way
<pre>
- arouter = require('./arouter')
- arouter.router(routes,app)
+arouter = require('./arouter')
+arouter.router(routes,app)
</pre>
where 'app' is the express app instance.

0 comments on commit f2fe2ad

Please sign in to comment.