Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

publish version 0.4.7

  • Loading branch information...
commit a8e993de0b32a02dcb3077cc5ce86b9bd9c252e2 1 parent e42971e
@shimaore shimaore authored
View
7 CHANGELOG.md
@@ -1,3 +1,10 @@
+**0.4.7** (2012-08-25)
+
+ * Added `@req` and `@res` to the handler. (#20, end)
+ * Use `real_root` to locate modules to be included (#34)
+ * Working scenario for separate Express and Socket.IO servers. (#32)
+ * Renamed example/assets.coffee into examples/connect-assets.coffee
+
**v0.4.6** (2012-08-15)
* Added `@req` and `@res` due to popular demand. (#20)
View
13 docs/client.html
@@ -5,8 +5,7 @@
<span class="nv">settings = </span><span class="kc">null</span>
<span class="nv">zappa.run = </span><span class="nf">(func) -&gt;</span>
- <span class="nv">context = </span><span class="p">{}</span>
- </pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Storage for the functions provided by the user.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">ws_handlers = </span><span class="p">{}</span>
+ <span class="nv">context = </span><span class="p">{}</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Storage for the functions provided by the user.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">ws_handlers = </span><span class="p">{}</span>
<span class="nv">helpers = </span><span class="p">{}</span>
<span class="nv">apply_helpers = </span><span class="nf">(ctx) -&gt;</span>
@@ -39,7 +38,7 @@
<span class="nv">context.connect = </span><span class="o">-&gt;</span>
<span class="nv">context.socket = </span><span class="nx">io</span><span class="p">.</span><span class="nx">connect</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">io</span><span class="p">,</span> <span class="nx">arguments</span>
-
+
<span class="nv">context.emit = </span><span class="o">-&gt;</span>
<span class="k">if</span> <span class="k">typeof</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">isnt</span> <span class="s">&#39;object&#39;</span>
<span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="nx">emit</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">,</span> <span class="nx">arguments</span>
@@ -47,6 +46,9 @@
<span class="k">for</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span> <span class="k">of</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="nx">emit</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">,</span> <span class="p">[</span><span class="nx">k</span><span class="p">,</span> <span class="nx">v</span><span class="p">]</span>
+ <span class="nv">context.share = </span><span class="nf">(channel,socket,cb) -&gt;</span>
+ <span class="nx">$</span><span class="p">.</span><span class="nx">getJSON</span> <span class="s">&quot;/zappa/socket/</span><span class="si">#{</span><span class="nx">channel</span><span class="si">}</span><span class="s">/</span><span class="si">#{</span><span class="nx">socket</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="nx">sessionid</span><span class="si">}</span><span class="s">&quot;</span><span class="p">,</span> <span class="nx">cb</span>
+
<span class="nv">route = </span><span class="nf">(r) -&gt;</span>
<span class="nv">ctx = </span><span class="p">{</span><span class="nx">app</span><span class="p">}</span>
@@ -61,6 +63,10 @@
<span class="k">when</span> <span class="s">&#39;this&#39;</span> <span class="k">then</span> <span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">sammy_context</span><span class="p">.</span><span class="nx">params</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span>
<span class="k">when</span> <span class="s">&#39;param&#39;</span> <span class="k">then</span> <span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">sammy_context</span><span class="p">.</span><span class="nx">params</span><span class="p">])</span>
<span class="k">else</span> <span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>GO!!!</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">func</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">context</span><span class="p">,</span> <span class="p">[</span><span class="nx">context</span><span class="p">])</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Implements the websockets client with socket.io.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="o">?</span>
+ <span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="kc">on</span> <span class="s">&#39;connect&#39;</span><span class="p">,</span> <span class="o">-&gt;</span>
+ <span class="nx">context</span><span class="p">.</span><span class="nx">share</span> <span class="s">&#39;__local&#39;</span><span class="p">,</span> <span class="nx">socket</span><span class="p">,</span> <span class="nf">(data) -&gt;</span>
+ <span class="nv">context.key = </span><span class="nx">data</span><span class="p">.</span><span class="nx">key</span>
+
<span class="k">for</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">h</span> <span class="k">of</span> <span class="nx">ws_handlers</span>
<span class="nx">do</span> <span class="nf">(name, h) -&gt;</span>
<span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="kc">on</span> <span class="nx">name</span><span class="p">,</span> <span class="nf">(data) -&gt;</span>
@@ -70,6 +76,7 @@
<span class="nv">id: </span><span class="nx">context</span><span class="p">.</span><span class="nx">socket</span><span class="p">.</span><span class="nx">id</span>
<span class="nv">data: </span><span class="nx">data</span>
<span class="nv">emit: </span><span class="nx">context</span><span class="p">.</span><span class="nx">emit</span>
+ <span class="nv">share: </span><span class="nx">context</span><span class="p">.</span><span class="nx">share</span>
<span class="nx">apply_helpers</span> <span class="nx">ctx</span>
View
79 docs/zappa.html
@@ -1,8 +1,8 @@
<!DOCTYPE html> <html> <head> <title>zappa.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="client.html"> client.coffee </a> <a class="source" href="zappa.html"> zappa.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> zappa.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p><strong>Zappa</strong> is a <a href="http://coffeescript.org">CoffeeScript</a> DSL-ish interface for building web apps on the
<a href="http://nodejs.org">node.js</a> runtime, integrating <a href="http://expressjs.com">express</a>, <a href="http://socket.io">socket.io</a>
-and other best-of-breed libraries.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">zappa = version: </span><span class="s">&#39;0.4.6&#39;</span>
+and other best-of-breed libraries.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">zappa = version: </span><span class="s">&#39;0.4.7&#39;</span>
-<span class="nv">codename = </span><span class="s">&#39;Wowie Zowie&#39;</span>
+<span class="nv">codename = </span><span class="s">&#39;Freak Out!&#39;</span>
<span class="nv">log = </span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span>
<span class="nv">fs = </span><span class="nx">require</span> <span class="s">&#39;fs&#39;</span>
@@ -10,7 +10,9 @@
<span class="nv">uuid = </span><span class="nx">require</span> <span class="s">&#39;node-uuid&#39;</span>
<span class="nv">jquery = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/../vendor/jquery-1.8.0.min.js&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">()</span>
<span class="nv">sammy = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">__dirname</span> <span class="o">+</span> <span class="s">&#39;/../vendor/sammy-0.7.1.min.js&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">()</span>
-<span class="nv">uglify = </span><span class="nx">require</span> <span class="s">&#39;uglify-js&#39;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Soft dependencies:</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">jsdom = </span><span class="kc">null</span>
+<span class="nv">uglify = </span><span class="nx">require</span> <span class="s">&#39;uglify-js&#39;</span>
+
+<span class="nv">socketio_key = </span><span class="s">&#39;__session&#39;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Soft dependencies:</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">jsdom = </span><span class="kc">null</span>
<span class="nv">express_partials = </span><span class="kc">null</span>
<span class="nv">coffee_css = </span><span class="kc">null</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>CoffeeScript-generated JavaScript may contain anyone of these; when we "rewrite"
a function (see below) though, it loses access to its parent scope, and consequently to
@@ -87,7 +89,7 @@
<span class="k">else</span>
<span class="nv">context.server = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;http&#39;</span><span class="p">).</span><span class="nx">createServer</span> <span class="nx">app</span>
<span class="nv">io = </span><span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">disable_io</span> <span class="k">then</span> <span class="kc">null</span> <span class="k">else</span> <span class="nv">context.io = </span><span class="nx">socketio</span><span class="p">.</span><span class="nx">listen</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nx">server</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>Reference to the zappa client, the value will be set later.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">client = </span><span class="kc">null</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>Tracks if the zappa middleware is already mounted (<code>@use 'zappa'</code>).</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">zappa_used = </span><span class="kc">no</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">&#182;</a> </div> <p>Zappa's default settings.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">app</span><span class="p">.</span><span class="nx">set</span> <span class="s">&#39;view engine&#39;</span><span class="p">,</span> <span class="s">&#39;coffee&#39;</span>
- <span class="nx">app</span><span class="p">.</span><span class="nx">engine</span> <span class="s">&#39;coffee&#39;</span><span class="p">,</span> <span class="nx">coffeecup_adapter</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">&#182;</a> </div> <p>Sets default view dir to @root (<code>path.dirname(module.parent.filename)</code>).</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">app</span><span class="p">.</span><span class="nx">set</span> <span class="s">&#39;views&#39;</span><span class="p">,</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nx">root</span><span class="p">,</span> <span class="s">&#39;/views&#39;</span><span class="p">)</span>
+ <span class="nx">app</span><span class="p">.</span><span class="nx">engine</span> <span class="s">&#39;coffee&#39;</span><span class="p">,</span> <span class="nx">coffeecup_adapter</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">&#182;</a> </div> <p>Sets default view dir to @root</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">app</span><span class="p">.</span><span class="nx">set</span> <span class="s">&#39;views&#39;</span><span class="p">,</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nx">root</span><span class="p">,</span> <span class="s">&#39;/views&#39;</span><span class="p">)</span>
<span class="k">for</span> <span class="nx">verb</span> <span class="k">in</span> <span class="p">[</span><span class="s">&#39;get&#39;</span><span class="p">,</span> <span class="s">&#39;post&#39;</span><span class="p">,</span> <span class="s">&#39;put&#39;</span><span class="p">,</span> <span class="s">&#39;del&#39;</span><span class="p">]</span>
<span class="nx">do</span> <span class="nf">(verb) -&gt;</span>
@@ -200,6 +202,8 @@
<span class="k">for</span> <span class="nx">k</span><span class="p">,</span><span class="nx">v</span> <span class="k">of</span> <span class="nx">maps</span>
<span class="nx">partials</span><span class="p">.</span><span class="nx">register</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span>
<span class="nx">partials</span>
+ <span class="nv">session_store: </span><span class="nf">(store) -&gt;</span>
+ <span class="nv">context.session_store = </span><span class="nx">store</span>
<span class="nv">use = </span><span class="nf">(name, arg = null) -&gt;</span>
<span class="k">if</span> <span class="nx">zappa_middleware</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span>
@@ -232,7 +236,7 @@
<span class="nx">v</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">context</span><span class="p">,</span> <span class="p">[</span><span class="nx">context</span><span class="p">])</span>
<span class="nv">context.include = </span><span class="nf">(p) -&gt;</span>
- <span class="nv">sub = </span><span class="k">if</span> <span class="k">typeof</span> <span class="nx">p</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span> <span class="k">then</span> <span class="nx">require</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nx">root</span><span class="p">,</span> <span class="nx">p</span><span class="p">)</span> <span class="k">else</span> <span class="nx">p</span>
+ <span class="nv">sub = </span><span class="k">if</span> <span class="k">typeof</span> <span class="nx">p</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span> <span class="k">then</span> <span class="nx">require</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">context</span><span class="p">.</span><span class="nx">real_root</span><span class="p">,</span> <span class="nx">p</span><span class="p">)</span> <span class="k">else</span> <span class="nx">p</span>
<span class="nx">sub</span><span class="p">.</span><span class="nx">include</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">context</span><span class="p">,</span> <span class="p">[</span><span class="nx">context</span><span class="p">])</span>
<span class="nv">apply_helpers = </span><span class="nf">(ctx) -&gt;</span>
@@ -244,8 +248,18 @@
<span class="nx">helper</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">ctx</span><span class="p">,</span> <span class="nx">args</span>
<span class="k">else</span>
<span class="nx">ctx</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="nx">helper</span>
- <span class="nx">ctx</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-15">&#182;</a> </div> <p>Register a route with express.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">route = </span><span class="nf">(r) -&gt;</span>
- <span class="nx">r</span><span class="p">.</span><span class="nx">middleware</span> <span class="o">?=</span> <span class="p">[]</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16">&#182;</a> </div> <p>Rewrite middleware</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">r.middleware = </span><span class="nx">r</span><span class="p">.</span><span class="nx">middleware</span><span class="p">.</span><span class="nx">map</span> <span class="nf">(f) -&gt;</span>
+ <span class="nx">ctx</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-15">&#182;</a> </div> <p>Local socket</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">request_socket = </span><span class="nf">(req) -&gt;</span>
+ <span class="nv">socket_id = </span><span class="nx">req</span><span class="p">.</span><span class="nx">session</span><span class="o">?</span><span class="p">.</span><span class="nx">__socket</span><span class="o">?</span><span class="p">[</span><span class="s">&#39;__local&#39;</span><span class="p">]</span><span class="o">?</span><span class="p">.</span><span class="nx">id</span>
+ <span class="nx">socket_id</span> <span class="o">and</span> <span class="nx">io</span><span class="o">?</span><span class="p">.</span><span class="nx">sockets</span><span class="p">.</span><span class="nx">socket</span> <span class="nx">socket_id</span><span class="p">,</span> <span class="kc">true</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16">&#182;</a> </div> <p>The callback will receive (err,session).</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">socket_session = </span><span class="nf">(socket,cb) -&gt;</span>
+ <span class="nx">socket</span><span class="p">.</span><span class="nx">get</span> <span class="nx">socketio_key</span><span class="p">,</span> <span class="nf">(err,data) -&gt;</span>
+ <span class="k">if</span> <span class="nx">err</span>
+ <span class="k">return</span> <span class="nx">cb</span> <span class="nx">err</span>
+ <span class="nv">data = </span><span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">data</span>
+ <span class="k">if</span> <span class="nx">data</span><span class="p">.</span><span class="nx">id</span><span class="o">?</span>
+ <span class="nx">context</span><span class="p">.</span><span class="nx">session_store</span><span class="p">.</span><span class="nx">get</span> <span class="nx">data</span><span class="p">.</span><span class="nx">id</span><span class="p">,</span> <span class="nx">cb</span>
+ <span class="k">else</span>
+ <span class="nx">cb</span> <span class="nx">err</span></pre></div> </td> </tr> <tr id="section-17"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-17">&#182;</a> </div> <p>Register a route with express.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">route = </span><span class="nf">(r) -&gt;</span>
+ <span class="nx">r</span><span class="p">.</span><span class="nx">middleware</span> <span class="o">?=</span> <span class="p">[]</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-18">&#182;</a> </div> <p>Rewrite middleware</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">r.middleware = </span><span class="nx">r</span><span class="p">.</span><span class="nx">middleware</span><span class="p">.</span><span class="nx">map</span> <span class="nf">(f) -&gt;</span>
<span class="nf">(req,res,next) -&gt;</span>
<span class="nv">ctx =</span>
<span class="nv">app: </span><span class="nx">app</span>
@@ -281,11 +295,13 @@
<span class="nv">app: </span><span class="nx">app</span>
<span class="nv">settings: </span><span class="nx">app</span><span class="p">.</span><span class="nx">settings</span>
<span class="nv">request: </span><span class="nx">req</span>
+ <span class="nv">req: </span><span class="nx">req</span>
<span class="nv">query: </span><span class="nx">req</span><span class="p">.</span><span class="nx">query</span>
<span class="nv">params: </span><span class="nx">req</span><span class="p">.</span><span class="nx">params</span>
<span class="nv">body: </span><span class="nx">req</span><span class="p">.</span><span class="nx">body</span>
<span class="nv">session: </span><span class="nx">req</span><span class="p">.</span><span class="nx">session</span>
<span class="nv">response: </span><span class="nx">res</span>
+ <span class="nv">res: </span><span class="nx">res</span>
<span class="nv">next: </span><span class="nx">next</span>
<span class="nv">send: </span><span class="o">-&gt;</span> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">arguments</span>
<span class="nv">json: </span><span class="o">-&gt;</span> <span class="nx">res</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">arguments</span>
@@ -296,6 +312,14 @@
<span class="k">else</span>
<span class="k">for</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span> <span class="k">of</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="nx">render</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">@</span><span class="p">,</span> <span class="p">[</span><span class="nx">k</span><span class="p">,</span> <span class="nx">v</span><span class="p">]</span>
+ <span class="nv">emit: </span><span class="o">-&gt;</span>
+ <span class="nv">socket = </span><span class="nx">request_socket</span> <span class="nx">req</span>
+ <span class="k">if</span> <span class="nx">socket</span><span class="o">?</span>
+ <span class="k">if</span> <span class="k">typeof</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">isnt</span> <span class="s">&#39;object&#39;</span>
+ <span class="nx">socket</span><span class="p">.</span><span class="nx">emit</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">socket</span><span class="p">,</span> <span class="nx">arguments</span>
+ <span class="k">else</span>
+ <span class="k">for</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span> <span class="k">of</span> <span class="nx">arguments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+ <span class="nx">socket</span><span class="p">.</span><span class="nx">emit</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">socket</span><span class="p">,</span> <span class="p">[</span><span class="nx">k</span><span class="p">,</span> <span class="nx">v</span><span class="p">]</span>
<span class="nv">render = </span><span class="nf">(name,opts = {},fn) -&gt;</span>
@@ -303,7 +327,7 @@
<span class="k">if</span> <span class="nx">err</span>
<span class="nx">next</span> <span class="nx">err</span>
<span class="k">else</span>
- <span class="nx">res</span><span class="p">.</span><span class="nx">send</span> <span class="nx">html</span></pre></div> </td> </tr> <tr id="section-17"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-17">&#182;</a> </div> <p>Make sure the second arg is an object.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="k">typeof</span> <span class="nx">opts</span> <span class="o">is</span> <span class="s">&#39;function&#39;</span>
+ <span class="nx">res</span><span class="p">.</span><span class="nx">send</span> <span class="nx">html</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-19">&#182;</a> </div> <p>Make sure the second arg is an object.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="k">typeof</span> <span class="nx">opts</span> <span class="o">is</span> <span class="s">&#39;function&#39;</span>
<span class="nv">fn = </span><span class="nx">opts</span>
<span class="nv">opts = </span><span class="p">{}</span>
@@ -314,7 +338,7 @@
<span class="nv">postrender = </span><span class="nx">report</span>
<span class="k">else</span>
<span class="nv">postrender = </span><span class="nf">(err, str) -&gt;</span>
- <span class="k">if</span> <span class="nx">err</span> <span class="k">then</span> <span class="k">return</span> <span class="nx">report</span> <span class="nx">err</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-18">&#182;</a> </div> <p>Apply postrender before sending response.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">jsdom</span><span class="p">.</span><span class="nx">env</span> <span class="nv">html: </span><span class="nx">str</span><span class="p">,</span> <span class="nv">src: </span><span class="p">[</span><span class="nx">jquery</span><span class="p">],</span> <span class="nv">done: </span><span class="nf">(err, window) -&gt;</span>
+ <span class="k">if</span> <span class="nx">err</span> <span class="k">then</span> <span class="k">return</span> <span class="nx">report</span> <span class="nx">err</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-20">&#182;</a> </div> <p>Apply postrender before sending response.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">jsdom</span><span class="p">.</span><span class="nx">env</span> <span class="nv">html: </span><span class="nx">str</span><span class="p">,</span> <span class="nv">src: </span><span class="p">[</span><span class="nx">jquery</span><span class="p">],</span> <span class="nv">done: </span><span class="nf">(err, window) -&gt;</span>
<span class="k">if</span> <span class="nx">err</span> <span class="k">then</span> <span class="k">return</span> <span class="nx">report</span> <span class="nx">err</span>
<span class="nv">ctx.window = </span><span class="nb">window</span>
<span class="nv">rendered = </span><span class="nx">postrenders</span><span class="p">[</span><span class="nx">opts</span><span class="p">.</span><span class="nx">postrender</span><span class="p">].</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nb">window</span><span class="p">.</span><span class="nx">$</span><span class="p">,</span> <span class="nx">ctx</span><span class="p">])</span>
@@ -329,14 +353,14 @@
<span class="k">if</span> <span class="nx">app</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="s">&#39;databag&#39;</span><span class="p">]</span>
<span class="nv">data = </span><span class="p">{}</span>
- <span class="nx">copy_data_to</span> <span class="nx">data</span><span class="p">,</span> <span class="p">[</span><span class="nx">req</span><span class="p">.</span><span class="nx">query</span><span class="p">,</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">,</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">]</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-19">&#182;</a> </div> <p>Go!</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">switch</span> <span class="nx">app</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="s">&#39;databag&#39;</span><span class="p">]</span>
+ <span class="nx">copy_data_to</span> <span class="nx">data</span><span class="p">,</span> <span class="p">[</span><span class="nx">req</span><span class="p">.</span><span class="nx">query</span><span class="p">,</span> <span class="nx">req</span><span class="p">.</span><span class="nx">params</span><span class="p">,</span> <span class="nx">req</span><span class="p">.</span><span class="nx">body</span><span class="p">]</span></pre></div> </td> </tr> <tr id="section-21"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-21">&#182;</a> </div> <p>Go!</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">switch</span> <span class="nx">app</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="s">&#39;databag&#39;</span><span class="p">]</span>
<span class="k">when</span> <span class="s">&#39;this&#39;</span> <span class="k">then</span> <span class="nv">result = </span><span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span>
<span class="k">when</span> <span class="s">&#39;param&#39;</span> <span class="k">then</span> <span class="nv">result = </span><span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">data</span><span class="p">])</span>
<span class="k">else</span> <span class="nv">result = </span><span class="nx">r</span><span class="p">.</span><span class="nx">handler</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span>
<span class="nx">res</span><span class="p">.</span><span class="nx">contentType</span><span class="p">(</span><span class="nx">r</span><span class="p">.</span><span class="nx">contentType</span><span class="p">)</span> <span class="k">if</span> <span class="nx">r</span><span class="p">.</span><span class="nx">contentType</span><span class="o">?</span>
<span class="k">if</span> <span class="k">typeof</span> <span class="nx">result</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span> <span class="k">then</span> <span class="nx">res</span><span class="p">.</span><span class="nx">send</span> <span class="nx">result</span>
- <span class="k">else</span> <span class="k">return</span> <span class="nx">result</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-20">&#182;</a> </div> <p>Register socket.io handlers.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">io</span><span class="o">?</span><span class="p">.</span><span class="nx">sockets</span><span class="p">.</span><span class="kc">on</span> <span class="s">&#39;connection&#39;</span><span class="p">,</span> <span class="nf">(socket) -&gt;</span>
+ <span class="k">else</span> <span class="k">return</span> <span class="nx">result</span></pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-22">&#182;</a> </div> <p>Register socket.io handlers.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">io</span><span class="o">?</span><span class="p">.</span><span class="nx">sockets</span><span class="p">.</span><span class="kc">on</span> <span class="s">&#39;connection&#39;</span><span class="p">,</span> <span class="nf">(socket) -&gt;</span>
<span class="nv">c = </span><span class="p">{}</span>
<span class="nv">build_ctx = </span><span class="o">-&gt;</span>
@@ -371,6 +395,7 @@
<span class="k">else</span>
<span class="k">for</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span> <span class="k">of</span> <span class="nx">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="nx">room</span><span class="p">.</span><span class="nx">emit</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">room</span><span class="p">,</span> <span class="p">[</span><span class="nx">k</span><span class="p">,</span> <span class="nx">v</span><span class="p">]</span>
+ <span class="nv">session: </span><span class="o">-&gt;</span> <span class="nx">socket_session</span> <span class="nx">socket</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">...</span>
<span class="nx">apply_helpers</span> <span class="nx">ctx</span>
<span class="nx">ctx</span>
@@ -392,7 +417,7 @@
<span class="k">switch</span> <span class="nx">app</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="s">&#39;databag&#39;</span><span class="p">]</span>
<span class="k">when</span> <span class="s">&#39;this&#39;</span> <span class="k">then</span> <span class="nx">h</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span>
<span class="k">when</span> <span class="s">&#39;param&#39;</span> <span class="k">then</span> <span class="nx">h</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">data</span><span class="p">])</span>
- <span class="k">else</span> <span class="nx">h</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span></pre></div> </td> </tr> <tr id="section-21"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-21">&#182;</a> </div> <p>Go!</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">func</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">context</span><span class="p">,</span> <span class="p">[</span><span class="nx">context</span><span class="p">])</span></pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-22">&#182;</a> </div> <p>The stringified zappa client.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">client = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./client&#39;</span><span class="p">).</span><span class="nx">build</span><span class="p">(</span><span class="nx">zappa</span><span class="p">.</span><span class="nx">version</span><span class="p">,</span> <span class="nx">app</span><span class="p">.</span><span class="nx">settings</span><span class="p">)</span>
+ <span class="k">else</span> <span class="nx">h</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">ctx</span><span class="p">,</span> <span class="p">[</span><span class="nx">ctx</span><span class="p">])</span></pre></div> </td> </tr> <tr id="section-23"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-23">&#182;</a> </div> <p>Go!</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">func</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="nx">context</span><span class="p">,</span> <span class="p">[</span><span class="nx">context</span><span class="p">])</span></pre></div> </td> </tr> <tr id="section-24"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-24">&#182;</a> </div> <p>The stringified zappa client.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">client = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./client&#39;</span><span class="p">).</span><span class="nx">build</span><span class="p">(</span><span class="nx">zappa</span><span class="p">.</span><span class="nx">version</span><span class="p">,</span> <span class="nx">app</span><span class="p">.</span><span class="nx">settings</span><span class="p">)</span>
<span class="nv">client = </span><span class="s">&quot;;</span><span class="si">#{</span><span class="nx">coffeescript_helpers</span><span class="si">}</span><span class="s">(</span><span class="si">#{</span><span class="nx">client</span><span class="si">}</span><span class="s">)();&quot;</span>
<span class="nv">client = </span><span class="nx">minify</span><span class="p">(</span><span class="nx">client</span><span class="p">)</span> <span class="k">if</span> <span class="nx">app</span><span class="p">.</span><span class="nx">settings</span><span class="p">[</span><span class="s">&#39;minify&#39;</span><span class="p">]</span>
@@ -413,7 +438,27 @@
<span class="nx">style</span> <span class="nx">@style</span> <span class="k">if</span> <span class="nx">@style</span>
<span class="nx">body</span> <span class="nx">@body</span>
- <span class="nx">context</span></pre></div> </td> </tr> <tr id="section-23"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-23">&#182;</a> </div> <p>zappa.run [host,] [port,] [{options},] root_function
+ <span class="k">if</span> <span class="nx">io</span><span class="o">?</span>
+ <span class="nx">context</span><span class="p">.</span><span class="nx">get</span> <span class="s">&#39;/zappa/socket/:channel_name/:socket_id&#39;</span><span class="p">,</span> <span class="o">-&gt;</span>
+ <span class="k">if</span> <span class="nx">@session</span><span class="o">?</span>
+ <span class="nv">channel_name = </span><span class="nx">@params</span><span class="p">.</span><span class="nx">channel_name</span>
+ <span class="nv">socket_id = </span><span class="nx">@params</span><span class="p">.</span><span class="nx">socket_id</span>
+
+ <span class="nx">@session</span><span class="p">.</span><span class="nx">__socket</span> <span class="o">?=</span> <span class="p">{}</span>
+
+ <span class="k">if</span> <span class="nx">@session</span><span class="p">.</span><span class="nx">__socket</span><span class="p">[</span><span class="nx">channel_name</span><span class="p">]</span><span class="o">?</span></pre></div> </td> </tr> <tr id="section-25"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-25">&#182;</a> </div> <p>Client (or hijacker) trying to re-key.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">@send</span> <span class="nx">error</span><span class="o">:</span><span class="s">&#39;Channel already assigned&#39;</span><span class="p">,</span> <span class="nv">channel_name: </span><span class="nx">channel_name</span>
+ <span class="k">else</span>
+ <span class="nv">key = </span><span class="nx">uuid</span><span class="p">()</span> <span class="c1"># used for socket &#39;authorization&#39;</span></pre></div> </td> </tr> <tr id="section-26"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-26">&#182;</a> </div> <p>Update the Express session store</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">@session</span><span class="p">.</span><span class="nx">__socket</span><span class="p">[</span><span class="nx">channel_name</span><span class="p">]</span> <span class="o">=</span>
+ <span class="nv">id: </span><span class="nx">socket_id</span>
+ <span class="nv">key: </span><span class="nx">key</span></pre></div> </td> </tr> <tr id="section-27"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-27">&#182;</a> </div> <p>Update the Socket.IO store</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">io_client = </span><span class="nx">io</span><span class="p">.</span><span class="nx">sockets</span><span class="p">.</span><span class="nx">store</span><span class="p">.</span><span class="nx">client</span><span class="p">(</span><span class="nx">socket_id</span><span class="p">)</span>
+ <span class="nv">io_data = </span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span>
+ <span class="nv">id: </span><span class="nx">@req</span><span class="p">.</span><span class="nx">sessionID</span>
+ <span class="nv">key: </span><span class="nx">key</span>
+ <span class="nx">io_client</span><span class="p">.</span><span class="nx">set</span> <span class="nx">socketio_key</span><span class="p">,</span> <span class="nx">io_data</span></pre></div> </td> </tr> <tr id="section-28"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-28">&#182;</a> </div> <p>Let the client know which key to use.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">@send</span> <span class="nv">channel_name: </span><span class="nx">channel_name</span><span class="p">,</span> <span class="nv">key: </span><span class="nx">key</span>
+ <span class="k">else</span>
+ <span class="nx">@send</span> <span class="nx">error</span><span class="o">:</span><span class="s">&#39;No session&#39;</span>
+
+ <span class="nx">context</span></pre></div> </td> </tr> <tr id="section-29"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-29">&#182;</a> </div> <p>zappa.run [host,] [port,] [{options},] root_function
Takes a function and runs it as a zappa app. Optionally accepts a port number, and/or
a hostname (any order). The hostname must be a string, and the port number must be
castable as a number.
@@ -454,7 +499,7 @@
<span class="nx">log</span> <span class="s">&quot;Zappa </span><span class="si">#{</span><span class="nx">zappa</span><span class="p">.</span><span class="nx">version</span><span class="si">}</span><span class="s"> \&quot;</span><span class="si">#{</span><span class="nx">codename</span><span class="si">}</span><span class="s">\&quot; orchestrating the show&quot;</span>
- <span class="nx">zapp</span></pre></div> </td> </tr> <tr id="section-24"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-24">&#182;</a> </div> <p>Creates a zappa view adapter for templating engine <code>engine</code>. This adapter
+ <span class="nx">zapp</span></pre></div> </td> </tr> <tr id="section-30"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-30">&#182;</a> </div> <p>Creates a zappa view adapter for templating engine <code>engine</code>. This adapter
can be used with <code>context.engine</code> or <code>context.use partials:</code>
and creates params "shortcuts".</p>
@@ -477,20 +522,20 @@
<span class="nv">engine = </span><span class="nx">require</span><span class="p">(</span><span class="nx">engine</span><span class="p">)</span> <span class="k">if</span> <span class="k">typeof</span> <span class="nx">engine</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span>
<span class="nv">compile = </span><span class="nf">(template, data) -&gt;</span>
<span class="nv">template = </span><span class="nx">engine</span><span class="p">.</span><span class="nx">compile</span><span class="p">(</span><span class="nx">template</span><span class="p">,</span> <span class="nx">data</span><span class="p">)</span>
- <span class="nf">(data) -&gt;</span></pre></div> </td> </tr> <tr id="section-25"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-25">&#182;</a> </div> <p>Merge down <code>@params</code> into <code>@</code>
+ <span class="nf">(data) -&gt;</span></pre></div> </td> </tr> <tr id="section-31"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-31">&#182;</a> </div> <p>Merge down <code>@params</code> into <code>@</code>
Bonus: if <code>databag</code> is enabled, <code>@params</code> will be the complete databag.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">for</span> <span class="nx">k</span><span class="p">,</span> <span class="nx">v</span> <span class="k">of</span> <span class="nx">data</span><span class="p">.</span><span class="nx">params</span>
<span class="k">if</span> <span class="k">typeof</span> <span class="nx">data</span><span class="p">[</span><span class="nx">k</span><span class="p">]</span> <span class="o">is</span> <span class="s">&#39;undefined&#39;</span> <span class="o">and</span> <span class="nx">k</span> <span class="o">not</span> <span class="k">in</span> <span class="nx">options</span><span class="p">.</span><span class="nx">blacklist</span>
<span class="nx">data</span><span class="p">[</span><span class="nx">k</span><span class="p">]</span> <span class="o">=</span> <span class="nx">v</span>
<span class="nx">template</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span>
<span class="nv">render = </span><span class="nf">(template,data) -&gt;</span>
<span class="nv">template = </span><span class="nx">compile</span> <span class="nx">template</span><span class="p">,</span> <span class="nx">data</span>
- <span class="nx">template</span> <span class="nx">data</span></pre></div> </td> </tr> <tr id="section-26"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-26">&#182;</a> </div> <p>Express 3.x object:</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">renderFile = </span><span class="nf">(name,data,fn) -&gt;</span>
+ <span class="nx">template</span> <span class="nx">data</span></pre></div> </td> </tr> <tr id="section-32"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-32">&#182;</a> </div> <p>Express 3.x object:</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">renderFile = </span><span class="nf">(name,data,fn) -&gt;</span>
<span class="k">try</span>
<span class="nv">template = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">name</span><span class="p">,</span><span class="s">&#39;utf8&#39;</span><span class="p">)</span>
<span class="nv">template = </span><span class="nx">compile</span> <span class="nx">template</span><span class="p">,</span> <span class="nx">data</span>
<span class="k">catch</span> <span class="nx">err</span>
<span class="k">return</span> <span class="nx">fn</span> <span class="nx">err</span>
- <span class="nx">fn</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">template</span> <span class="nx">data</span></pre></div> </td> </tr> <tr id="section-27"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-27">&#182;</a> </div> <p>Express 2.x extensions:</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">renderFile.compile = </span><span class="nx">compile</span>
+ <span class="nx">fn</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">template</span> <span class="nx">data</span></pre></div> </td> </tr> <tr id="section-33"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-33">&#182;</a> </div> <p>Express 2.x extensions:</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">renderFile.compile = </span><span class="nx">compile</span>
<span class="nv">renderFile.render = </span><span class="nx">render</span>
<span class="nx">renderFile</span>
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "zappajs",
"description": "CoffeeScript minimalist interface to express, socket.io and others",
- "version": "0.4.6",
+ "version": "0.4.7",
"author": "Stephane Alnet <stephane@shimaore.net>",
"homepage": "http://zappajs.github.com/zappajs/",
"repository": {"type": "git", "url": "git://github.com/zappajs/zappajs.git"},
View
4 src/zappa.coffee
@@ -2,9 +2,9 @@
# [node.js](http://nodejs.org) runtime, integrating [express](http://expressjs.com), [socket.io](http://socket.io)
# and other best-of-breed libraries.
-zappa = version: '0.4.6'
+zappa = version: '0.4.7'
-codename = 'Wowie Zowie'
+codename = 'Freak Out!'
log = console.log
fs = require 'fs'
Please sign in to comment.
Something went wrong with that request. Please try again.