summaryrefslogtreecommitdiffstats
path: root/_site/nodejs-restify-mongodb-mongoose
diff options
context:
space:
mode:
Diffstat (limited to '_site/nodejs-restify-mongodb-mongoose')
-rw-r--r--_site/nodejs-restify-mongodb-mongoose/index.html209
1 files changed, 83 insertions, 126 deletions
diff --git a/_site/nodejs-restify-mongodb-mongoose/index.html b/_site/nodejs-restify-mongodb-mongoose/index.html
index 782970c..8a548da 100644
--- a/_site/nodejs-restify-mongodb-mongoose/index.html
+++ b/_site/nodejs-restify-mongodb-mongoose/index.html
@@ -5,71 +5,54 @@
<title>Simple example - Node.js, Restify, MongoDb and Mongoose - Backbone.js Tutorials</title>
<link href="/atom.xml" rel="alternate" title="backbone tutorials" type="application/atom+xml">
<meta name="author" content="Backbone Tutorials" />
-
<!-- syntax highlighting CSS -->
<!-- syntax highlighting CSS -->
<link rel="stylesheet" href="/css/syntax.css" type="text/css" />
- <link rel="stylesheet" href="http://cdn.moot.it/1.1/moot.css"/>
<!-- Homepage CSS -->
- <link rel="stylesheet" href="/css/bootstrap.css" type="text/css" media="screen, projection" />
+ <link rel="stylesheet" href="//bootswatch.com/sandstone/bootstrap.min.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen, projection" />
-
+ <link href="https://fonts.googleapis.com/css?family=Arvo:400,700&subset=latin" rel="stylesheet" type="text/css">
<!-- Typekit -->
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
- <script type="text/javascript">
-/* <![CDATA[ */
- (function() {
- var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
- s.type = 'text/javascript';
- s.async = true;
- s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
- t.parentNode.insertBefore(s, t);
- })();
-/* ]]> */
-</script>
- <!-- (1) Moot depends on jQuery v1.7 or greater -->
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
+
</head>
<body>
-<div class="container">
<div class="row">
- <div class="col-lg-12">
- <div class="navbar" style="margin-top:10px;">
- <div class="container">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="/">Backbone Tutorials</a>
- <div class="nav-collapse collapse navbar-responsive-collapse">
- <ul class="nav navbar-nav">
- <li class=""><a href="/">Home</a></li>
-
- </ul>
- <ul class="nav navbar-nav pull-right">
- <li><a href="http://feeds.feedburner.com/BackboneTutorials">Subscribe</a></li>
- <li><a href="https://leanpub.com/backbonetutorials">Download eBook (.pdf, .MOBI, .ePub)</a></li>
- </ul>
- </div><!-- /.nav-collapse -->
- </div><!-- /.container -->
- </div>
+ <div class="navbar navbar-default">
+ <div class="container">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="/">Backbone Tutorials</a>
+ </div>
+ <div class="navbar-collapse collapse navbar-responsive-collapse">
+ <ul class="nav navbar-nav">
+ <li class=""><a href="/">Home</a></li>
- </div>
+ </ul>
+ <ul class="nav navbar-nav navbar-right">
+ <li><a href="http://prerender.io"><strong>Need SEO?</strong></a></li>
+ <li><a href="http://feeds.feedburner.com/BackboneTutorials">Subscribe</a></li>
+ <li><a href="https://leanpub.com/backbonetutorials">Download eBook (.pdf, .MOBI, .ePub)</a></li>
+ </ul>
</div>
</div>
+</div>
+
-<div style=""></div>
<div class="container">
<div class="row">
<div class="col-lg-4">
@@ -79,12 +62,14 @@
</div>
<p>Backbone Tutorials is a collection of tutorials written by <a href="http://thomasdav.is">Thomas Davis</a>. Everything is open source and I try my best to keep the tutorials updated. Though I am busy and only work on this is my spare time so many <a href="https://github.com/thomasdavis/backbonetutorials/graphs/contributors">contributors</a> have also help me put this resource together.</p>
- </div>
+<a href="https://twitter.com/neutralthoughts" class="twitter-follow-button" data-show-count="true">Follow @neutralthoughts</a>
+<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
+ </div>
</div>
<div class="col-lg-8">
<h3 >Backbone.js Beginner Video Tutorial</h3>
<img src="/backbone.png" style="float: left;" /><p>I have put extra effort into making a very easy to understand Backbone.js video which is also free. It is 70mins long and covers everything you need to know when getting started.</p>
- <a href="http://gum.co/backbone-beginner-screencast" class="btn btn-primary">Watch Video</a>
+ <a href="https://www.youtube.com/watch?v=FZSjvWtUxYk" class="btn btn-primary">Watch Video</a>
</div>
</div>
<div class="container">
@@ -96,91 +81,85 @@
<div id="post">
-<h1>Simple example - Node.js, Restify, MongoDb and Mongoose</h1>
+<h1 id="simple-example---nodejs-restify-mongodb-and-mongoose">Simple example - Node.js, Restify, MongoDb and Mongoose</h1>
-<p>Before I start, the Backbone.js parts of this tutorial will be using techniques described in "Organizing your application using <a href="http://backbonetutorials.com/organizing-backbone-using-modules/">Modules</a> to construct a simple guestbook.</p>
+<p>Before I start, the Backbone.js parts of this tutorial will be using techniques described in “Organizing your application using <a href="http://backbonetutorials.com/organizing-backbone-using-modules/">Modules</a> to construct a simple guestbook.</p>
-<h2>Getting started</h2>
+<h2 id="getting-started">Getting started</h2>
<p>To easily understand this tutorial you should jump straight into the example code base.</p>
<p><a href="https://github.com/thomasdavis/backbonetutorials/tree/gh-pages/examples/nodejs-mongodb-mongoose-restify">Example Codebase</a></p>
-<p><a href="http://backbonetutorials.com/examples/nodejs-mongodb-mongoose-restify/">Example Demo</a></p>
+<p><a href="http://backbonetutorials.com/examples/nodejs-mongodb-mongoose-restify/app">Example Demo</a></p>
<p>This tutorial will assist you in saving data(Backbone.js Models) to MongoDb and retrieving a list(Backbone.js Collections) of them back.</p>
-<h2>The technologies</h2>
+<h2 id="the-technologies">The technologies</h2>
<p>This stack is great for rapid prototyping and highly intuitive. Personal note: I love using JavaScript as my only language for the entire application (FrontEnd/BackEnd/API/Database). Restify is still in early development but is essentially just an extension of Express. So for anyone needing more stability you can easily just substitute Express in.</p>
-<h3>Node.js</h3>
+<h3 id="nodejs">Node.js</h3>
-<p>"Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices."</p>
+<p>“Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.”</p>
-<h3>Restify</h3>
+<h3 id="restify">Restify</h3>
-<p>"Restify is a node.js module built specifically to enable you to build correct REST web services. It borrows heavily from express (intentionally) as that is more or less the de facto API for writing web applications on top of node.js."</p>
+<p>“Restify is a node.js module built specifically to enable you to build correct REST web services. It borrows heavily from express (intentionally) as that is more or less the de facto API for writing web applications on top of node.js.”</p>
-<h3>MongoDb</h3>
+<h3 id="mongodb">MongoDb</h3>
-<p>"MongoDB (from "humongous") is a scalable, high-performance, open source NoSQL database."</p>
+<p>“MongoDB (from “humongous”) is a scalable, high-performance, open source NoSQL database.”</p>
-<h3>Mongoose</h3>
+<h3 id="mongoose">Mongoose</h3>
-<p>"Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment."</p>
+<p>“Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.”</p>
-<h2>Building the server</h2>
+<h2 id="building-the-server">Building the server</h2>
<p>In the example repository there is a server.js example which can be executed by running <code>node server.js</code>. If you use this example in your own applications make sure to update the Backbone.js <a href="https://github.com/thomasdavis/backbonetutorials/blob/gh-pages/examples/nodejs-mongodb-mongoose-restify/js/models/message.js">Model</a> and <a href="https://github.com/thomasdavis/backbonetutorials/blob/gh-pages/examples/nodejs-mongodb-mongoose-restify/js/collections/messages.js">Collection</a> definitions to match your server address.</p>
-<h2>Restify configuration</h2>
+<h2 id="restify-configuration">Restify configuration</h2>
<p>The first thing to do is require the Restify module. Restify will be in control of handling our restful endpoints and returning the appropriate JSON.</p>
-<div class="highlight"><pre><code class="javascript"><span class="kd">var</span> <span class="nx">restify</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;restify&#39;</span><span class="p">);</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="kd">var</span> <span class="nx">restify</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;restify&#39;</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">server</span> <span class="o">=</span> <span class="nx">restify</span><span class="p">.</span><span class="nx">createServer</span><span class="p">();</span>
-<span class="nx">server</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="nx">restify</span><span class="p">.</span><span class="nx">bodyParser</span><span class="p">());</span>
-</code></pre></div>
-
+<span class="nx">server</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="nx">restify</span><span class="p">.</span><span class="nx">bodyParser</span><span class="p">());</span></code></pre></div>
<p>Note: bodyParser() takes care of turning your request data into a JavaScript object on the server automatically.</p>
-<h2>MongoDb/Mongoose configuration</h2>
+<h2 id="mongodbmongoose-configuration">MongoDb/Mongoose configuration</h2>
<p>We simply want to require the MongoDb module and pass it a MongoDb authentication URI e.g. mongodb://username:server@mongoserver:10059/somecollection</p>
<p>The code below presupposes you have another file in the same directory called <code>config.js</code>. Your config should never be public as it contains your credentials. So for this repository I have added <code>config.js</code> to my <code>.gitignore</code> but added in a <a href="https://github.com/thomasdavis/backbonetutorials/blob/gh-pages/examples/nodejs-mongodb-mongoose-restify/config-sample.js">sample config</a>.</p>
-<div class="highlight"><pre><code class="javascript"><span class="kd">var</span> <span class="nx">mongoose</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;mongoose/&#39;</span><span class="p">);</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="kd">var</span> <span class="nx">mongoose</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;mongoose/&#39;</span><span class="p">);</span>
<span class="kd">var</span> <span class="nx">config</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./config&#39;</span><span class="p">);</span>
<span class="nx">db</span> <span class="o">=</span> <span class="nx">mongoose</span><span class="p">.</span><span class="nx">connect</span><span class="p">(</span><span class="nx">config</span><span class="p">.</span><span class="nx">creds</span><span class="p">.</span><span class="nx">mongoose_auth</span><span class="p">),</span>
-<span class="nx">Schema</span> <span class="o">=</span> <span class="nx">mongoose</span><span class="p">.</span><span class="nx">Schema</span><span class="p">;</span>
-</code></pre></div>
+<span class="nx">Schema</span> <span class="o">=</span> <span class="nx">mongoose</span><span class="p">.</span><span class="nx">Schema</span><span class="p">;</span></code></pre></div>
-
-<h2>Mongoose Schema</h2>
+<h2 id="mongoose-schema">Mongoose Schema</h2>
<p>Mongoose introduces a concept of <a href="http://mongoosejs.com/docs/model-definition.html">model/schema</a> enforcing types which allow for easier input validation etc</p>
-<div class="highlight"><pre><code class="javascript"><span class="c1">// Create a schema for our data</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="c1">// Create a schema for our data</span>
<span class="kd">var</span> <span class="nx">MessageSchema</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Schema</span><span class="p">({</span>
<span class="nx">message</span><span class="o">:</span> <span class="nb">String</span><span class="p">,</span>
<span class="nx">date</span><span class="o">:</span> <span class="nb">Date</span>
<span class="p">});</span>
<span class="c1">// Use the schema to register a model with MongoDb</span>
<span class="nx">mongoose</span><span class="p">.</span><span class="nx">model</span><span class="p">(</span><span class="s1">&#39;Message&#39;</span><span class="p">,</span> <span class="nx">MessageSchema</span><span class="p">);</span>
-<span class="kd">var</span> <span class="nx">Message</span> <span class="o">=</span> <span class="nx">mongoose</span><span class="p">.</span><span class="nx">model</span><span class="p">(</span><span class="s1">&#39;Message&#39;</span><span class="p">);</span>
-</code></pre></div>
-
+<span class="kd">var</span> <span class="nx">Message</span> <span class="o">=</span> <span class="nx">mongoose</span><span class="p">.</span><span class="nx">model</span><span class="p">(</span><span class="s1">&#39;Message&#39;</span><span class="p">);</span></code></pre></div>
<p><em>Note: <code>Message</code> can now be used for all things CRUD related.</em></p>
-<h2>Setting up the routes</h2>
+<h2 id="setting-up-the-routes">Setting up the routes</h2>
<p>Just like in Backbone, Restify allows you to configure different routes and their associated callbacks. In the code below we define two routes. One for saving new messages and one for retrieving all messages. After we have created our function definitions, we attach them to either GET/POST/PUT/DELETE on a particular restful endpoint e.g. GET /messages</p>
-<div class="highlight"><pre><code class="javascript"><span class="c1">// This function is responsible for returning all entries for the Message model</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="c1">// This function is responsible for returning all entries for the Message model</span>
<span class="kd">function</span> <span class="nx">getMessages</span><span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="nx">res</span><span class="p">,</span> <span class="nx">next</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// Resitify currently has a bug which doesn&#39;t allow you to set default headers</span>
<span class="c1">// This headers comply with CORS and allow us to server our response to any origin</span>
@@ -209,9 +188,7 @@
<span class="c1">// Set up our routes and start the server</span>
<span class="nx">server</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;/messages&#39;</span><span class="p">,</span> <span class="nx">getMessages</span><span class="p">);</span>
-<span class="nx">server</span><span class="p">.</span><span class="nx">post</span><span class="p">(</span><span class="s1">&#39;/messages&#39;</span><span class="p">,</span> <span class="nx">postMessage</span><span class="p">);</span>
-</code></pre></div>
-
+<span class="nx">server</span><span class="p">.</span><span class="nx">post</span><span class="p">(</span><span class="s1">&#39;/messages&#39;</span><span class="p">,</span> <span class="nx">postMessage</span><span class="p">);</span></code></pre></div>
<p>This wraps up the server side of things, if you follow the <a href="https://github.com/thomasdavis/backbonetutorials/blob/gh-pages/examples/nodejs-mongodb-mongoose-restify/server.js">example</a> then you should see something like</p>
@@ -219,36 +196,33 @@
<p><em>Note: Again you must remember to change the <a href="https://github.com/thomasdavis/backbonetutorials/blob/gh-pages/examples/nodejs-mongodb-mongoose-restify/js/models/message.js">Model</a> and <a href="https://github.com/thomasdavis/backbonetutorials/blob/gh-pages/examples/nodejs-mongodb-mongoose-restify/js/collections/messages.js">Collection</a> definitions to match your server address.</em></p>
-<h2>Setting up the client (Backbone.js)</h2>
+<h2 id="setting-up-the-client-backbonejs">Setting up the client (Backbone.js)</h2>
-<p>I've actually used the latest copy of <a href="http://backboneboilerplate.com">http://backboneboilerplate.com</a> to set up the example page.</p>
+<p>I’ve actually used the latest copy of <a href="http://backboneboilerplate.com">http://backboneboilerplate.com</a> to set up the example page.</p>
<p>The important files you will want to check out are;</p>
<ul>
-<li>views/dashboard/page.js</li>
-<li>views/guestbook/form.js</li>
-<li>views/guestbook/list.js</li>
-<li>models/message.js</li>
-<li>collections/messages.js</li>
-<li>templates/guestbook/</li>
+ <li>views/dashboard/page.js</li>
+ <li>views/guestbook/form.js</li>
+ <li>views/guestbook/list.js</li>
+ <li>models/message.js</li>
+ <li>collections/messages.js</li>
+ <li>templates/guestbook/</li>
</ul>
-
-<h2>Saving a message</h2>
+<h2 id="saving-a-message">Saving a message</h2>
<p>First of all we want to setup a <a href="https://github.com/thomasdavis/backbonetutorials/blob/gh-pages/examples/nodejs-mongodb-mongoose-restify/templates/guestbook/form.html">template</a> for showing our form that creates new messages.</p>
-<div class="highlight"><pre><code class="javascript"><span class="o">&lt;</span><span class="nx">textarea</span> <span class="kr">class</span><span class="o">=</span><span class="s2">&quot;message&quot;</span><span class="o">&gt;&lt;</span><span class="err">/textarea&gt;</span>
-<span class="o">&lt;</span><span class="nx">button</span> <span class="kr">class</span><span class="o">=</span><span class="s2">&quot;post-message&quot;</span><span class="o">&gt;</span><span class="nx">Post</span> <span class="nx">Message</span><span class="o">&lt;</span><span class="err">/button&gt;</span>
-</code></pre></div>
-
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="o">&lt;</span><span class="nx">textarea</span> <span class="kr">class</span><span class="o">=</span><span class="s2">&quot;message&quot;</span><span class="o">&gt;&lt;</span><span class="err">/textarea&gt;</span>
+<span class="o">&lt;</span><span class="nx">button</span> <span class="kr">class</span><span class="o">=</span><span class="s2">&quot;post-message&quot;</span><span class="o">&gt;</span><span class="nx">Post</span> <span class="nx">Message</span><span class="o">&lt;</span><span class="err">/button&gt;</span></code></pre></div>
<p>This template gets inserted into the DOM by <code>views/guestbook/form.js</code>, this Backbone view also handles the interaction of the form and the posting of the new data.</p>
<p>Let us create a Backbone Model that has the correct URL for our restful interface.</p>
-<div class="highlight"><pre><code class="javascript"><span class="nx">define</span><span class="p">([</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="nx">define</span><span class="p">([</span>
<span class="s1">&#39;underscore&#39;</span><span class="p">,</span>
<span class="s1">&#39;backbone&#39;</span>
<span class="p">],</span> <span class="kd">function</span><span class="p">(</span><span class="nx">_</span><span class="p">,</span> <span class="nx">Backbone</span><span class="p">)</span> <span class="p">{</span>
@@ -256,13 +230,11 @@
<span class="nx">url</span><span class="o">:</span> <span class="s1">&#39;http://localhost:8080/messages&#39;</span>
<span class="p">});</span>
<span class="k">return</span> <span class="nx">Message</span><span class="p">;</span>
-<span class="p">});</span>
-</code></pre></div>
-
+<span class="p">});</span></code></pre></div>
<p>We can see how we require our predefined model for messages and also our form template.</p>
-<div class="highlight"><pre><code class="javascript"><span class="nx">define</span><span class="p">([</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="nx">define</span><span class="p">([</span>
<span class="s1">&#39;jquery&#39;</span><span class="p">,</span>
<span class="s1">&#39;underscore&#39;</span><span class="p">,</span>
<span class="s1">&#39;backbone&#39;</span><span class="p">,</span>
@@ -290,17 +262,15 @@
<span class="p">}</span>
<span class="p">});</span>
<span class="k">return</span> <span class="nx">GuestbookForm</span><span class="p">;</span>
-<span class="p">});</span>
-</code></pre></div>
-
+<span class="p">});</span></code></pre></div>
<p><em>Note: <code>trigger</code> is from Backbone Events, I binded a listener to this view in <code>views/dashboard/page.js</code> so when a new message is submitted, the list is re-rendered. We are setting the date of the POST on the server so there is no need to pass it up.</em></p>
-<h2>Retrieving a list of messages</h2>
+<h2 id="retrieving-a-list-of-messages">Retrieving a list of messages</h2>
<p>We setup a route on our server to generate a list of all available messages at <code>GET /messages</code>. So we need to define a collection with the appropriate <code>url</code> to fetch this data down.</p>
-<div class="highlight"><pre><code class="javascript"><span class="nx">define</span><span class="p">([</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="nx">define</span><span class="p">([</span>
<span class="s1">&#39;jquery&#39;</span><span class="p">,</span>
<span class="s1">&#39;underscore&#39;</span><span class="p">,</span>
<span class="s1">&#39;backbone&#39;</span><span class="p">,</span>
@@ -312,13 +282,11 @@
<span class="p">});</span>
<span class="k">return</span> <span class="nx">Messages</span><span class="p">;</span>
-<span class="p">});</span>
-</code></pre></div>
-
+<span class="p">});</span></code></pre></div>
<p>Now that we have a collection to use we can setup our <code>views/list.js</code> to require the collection and trigger a fetch. Once the fetch is complete we want to render our returned data to a template and insert it into the DOM.</p>
-<div class="highlight"><pre><code class="javascript"><span class="nx">define</span><span class="p">([</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="nx">define</span><span class="p">([</span>
<span class="s1">&#39;jquery&#39;</span><span class="p">,</span>
<span class="s1">&#39;underscore&#39;</span><span class="p">,</span>
<span class="s1">&#39;backbone&#39;</span><span class="p">,</span>
@@ -338,30 +306,26 @@
<span class="p">}</span>
<span class="p">});</span>
<span class="k">return</span> <span class="nx">GuestbookList</span><span class="p">;</span>
-<span class="p">});</span>
-</code></pre></div>
-
+<span class="p">});</span></code></pre></div>
<p>The template file should iterate over <code>messages.models</code> which is an array and print out a HTML fragment for each model.</p>
-<div class="highlight"><pre><code class="javascript"><span class="o">&lt;%</span> <span class="nx">_</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">messages</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="p">{</span> <span class="o">%&gt;</span>
+<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="o">&lt;%</span> <span class="nx">_</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">messages</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="p">{</span> <span class="o">%&gt;</span>
<span class="o">&lt;</span><span class="nx">p</span><span class="o">&gt;&lt;%=</span> <span class="nx">message</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;message&#39;</span><span class="p">)</span> <span class="o">%&gt;&lt;</span><span class="err">/p&gt;</span>
<span class="o">&lt;</span><span class="nx">em</span><span class="o">&gt;&lt;%=</span> <span class="nx">message</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">&#39;date&#39;</span><span class="p">)</span> <span class="o">%&gt;&lt;</span><span class="err">/em&gt;</span>
-<span class="o">&lt;%</span> <span class="p">});</span> <span class="o">%&gt;</span>
-</code></pre></div>
-
+<span class="o">&lt;%</span> <span class="p">});</span> <span class="o">%&gt;</span></code></pre></div>
<p>This actually sums up everything you need to know to implement this simple example.</p>
-<h2>Conclusion</h2>
+<h2 id="conclusion">Conclusion</h2>
<p><a href="https://github.com/thomasdavis/backbonetutorials/tree/gh-pages/examples/nodejs-mongodb-mongoose-restify">Example Codebase</a></p>
-<p><a href="http://backbonetutorials.com/examples/nodejs-mongodb-mongoose-restify/">Example Demo</a></p>
+<p><a href="http://backbonetutorials.com/examples/nodejs-mongodb-mongoose-restify/app">Example Demo</a></p>
-<p>In this example you should really be using relative URL's in your collections/models and instead setting a baseUrl in a config file or by placing your index.html file on the restful server.</p>
+<p>In this example you should really be using relative URL’s in your collections/models and instead setting a baseUrl in a config file or by placing your index.html file on the restful server.</p>
<p>This example is hosted on GitHub therefore we had to include the absolute URL to the server which is hosted on nodejitsu.com</p>
@@ -371,7 +335,7 @@
<p>Get in touch with me on twitter, comments or GitHub!</p>
-<h3>Relevant Links</h3>
+<h3 id="relevant-links">Relevant Links</h3>
<p><a href="http://weblog.bocoup.com/organizing-your-backbone-js-application-with-modules">Organizing Your Backbone.js Application With Modules</a></p>
@@ -387,7 +351,8 @@
<a href="https://plus.google.com/101608559187380638042?rel=author">Google Profile</a>
<a href="https://twitter.com/neutralthoughts">Twitter</a>
<a href="https://github.com/thomasdavis">Github</a>
-
+<a href="https://twitter.com/neutralthoughts" class="twitter-follow-button" data-show-count="true">Follow @neutralthoughts</a>
+<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div>
<div class="panel panel-info">
<div class="panel-heading">
@@ -410,17 +375,9 @@
</div>
</div>
-<!-- AddThis Button BEGIN -->
-<div class="addthis_toolbox addthis_floating_style addthis_counter_style" style="left:50px;top:50px;">
-<a class="addthis_button_facebook_like" fb:like:layout="box_count"></a>
-<a class="addthis_button_tweet" tw:count="vertical"></a>
-<a class="addthis_button_google_plusone" g:plusone:size="tall"></a>
-<a class="addthis_counter"></a>
-</div>
-<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xa-520b31815dc3cdc8"></script>
-<!-- AddThis Button END -->
<script src="//static.getclicky.com/js" type="text/javascript"></script>
<script type="text/javascript">try{ clicky.init(66406579); }catch(e){}</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/66406579ns.gif" /></p></noscript>
+
</body>
</html>