Permalink
Browse files

update copys

  • Loading branch information...
1 parent 4596d32 commit e443448b6856c11c6108626635ec749780b9b7f2 @edjafarov committed Sep 28, 2011
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/views/ejs/homePageBody.html
@@ -60,11 +60,30 @@
<h3>middleware</h3>
<p>Standard request flow goes through following chain:</p>
<p>
- filters->controller resolver->pre controller interceptors->controller->post controller interceptors->view resolver
+ [filters]->[controller resolver]->[pre controller interceptors]->[controller]->[post controller interceptors]->[view resolver]
which gives us flexibility of using middleware as filters, pre and post controller interceptors.
For example we can use connect's static middleware to handle static content as a filter which is the best to handle before controller resolver.
To assign class as filter we just need to put Filter annotation before constructor.
</p>
+<pre class="prettyprint sh_javascript">
+var connect = require("connect");
+var static = connect.static(__dirname + "/src/static");
+/**
+ * @Filter
+ */
+function StaticFilter(){}
+
+StaticFilter.prototype.filter=function(request, response){
+ var that=this;
+ static(request, response,
+ function(){
+ that.doNext(request, response);
+ }
+ );
+}
+</pre>
+<div><a href="https://github.com/edjafarov/aries/blob/master/src/filters/StaticFilter.js">see code</a></div>
+<div>see live? you are already seeing it. this site's static served by connect middleware</div>
<h3>there is more comming</h3>
<ul>
<li>session management</li>

0 comments on commit e443448

Please sign in to comment.