docs/index.html
<!DOCTYPE html>
<html>
<head>
<title>index.js used to create app and server.</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To …</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="src.html">
src.js
</a>
<a class="source" href="index.html">
index.js
</a>
<a class="source" href="flux.html">
flux.js
</a>
<a class="source" href="mvc.html">
mvc.js
</a>
</div>
</li>
</ul>
<ul class="sections">
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<h1 id="index-js-used-to-create-app-and-server-">index.js used to create app and server.</h1>
<p>See <a href="mvc.html">mvc.js</a> for required kronApp.</p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">var</span> kronApp = <span class="hljs-built_in">require</span>(<span class="hljs-string">'./mvc'</span>).kronApp;
<span class="hljs-keyword">var</span> http = <span class="hljs-built_in">require</span>(<span class="hljs-string">'http'</span>);</pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>Use start event to boot up server with app when Kronicle ready.</p>
</div>
<div class="content"><div class='highlight'><pre>kronApp.start(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(app)</span> </span>{</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<p>Create server.</p>
</div>
<div class="content"><div class='highlight'><pre> http.createServer(<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(req, res)</span> </span>{
<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'start server'</span>);
res.writeHead(<span class="hljs-number">200</span>, {<span class="hljs-string">'Content-Type'</span>: <span class="hljs-string">'text/plain'</span>});</pre></div></div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">¶</a>
</div>
<p>Render the view with thing as the data for an example.</p>
</div>
<div class="content"><div class='highlight'><pre> res.end(app.ListItemsController.view.render(<span class="hljs-literal">null</span>, <span class="hljs-string">'thing'</span>));
}).listen(<span class="hljs-number">3000</span>, <span class="hljs-string">'0.0.0.0'</span>);
});</pre></div></div>
</li>
</ul>
</div>
</body>
</html>