Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a good tech stack that I use for my applications:</p> <p>Server side:</p> <ul> <li>Express.js</li> <li>Handlebars</li> <li>Passport.js</li> <li>Mongoose</li> <li>MongoDB</li> <li>Caolan forms (But I am currently in the process of implementing my own form handler)</li> <li>Coffeescript</li> </ul> <p>Client side:</p> <ul> <li>Handlebars</li> <li>Jquery</li> <li>Require.js</li> <li>Backbone.js</li> <li>text.js (plugin for require.js)</li> <li>Coffeescript (plugin for require.js. My .coffee are compiled client side in dev and server side in prod using r.js)</li> </ul> <p>I might make a little sample app later if you want.</p> <p>[EDIT]</p> <p>ok here is a sample app.</p> <p><strong>Project structure:</strong></p> <pre><code>forms |___ sampleForm.coffee models |___ sampleModel.coffee public |___ images |___ stylesheets | |___ style.less |___ sampleapp |___ main.js |___ cs.js |___ text.js |___ require.js |___ collections | |___ sampleCollection.coffee |___ models | |___ sampleModel.coffee |___ templates | |___ sampleTemplate.hbs |___ lib | |___ handlesbars.js | |___ backbone.js | | |___ ... |___ views |___ sampleView.coffee routes |___ index.coffee views |___ index.hbs app.js application.coffee package.json </code></pre> <p><strong>Server side:</strong></p> <p><em>app.js</em></p> <pre><code>require('coffee-script'); module.exports = require('./application.coffee'); </code></pre> <p><strong>application.coffee</strong></p> <pre><code>... standard express.js initialization require("./routes")(app) ... start server </code></pre> <p><strong>index.coffee</strong></p> <pre><code>SampleModel = require "../models/sampleModel" module.exports = (app) =&gt; app.get "/index", (req,res) =&gt; return res.render "index" app.get "/samplemodels", (req,res) =&gt; SampleModel.find {}, (err, models) =&gt; return res.send 404 if err or !models return res.send models return </code></pre> <p><strong>index.hbs</strong></p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Sample app&lt;/title&gt; &lt;link type="text/css" href="/stylesheets/style.css" rel="stylesheet" &gt; &lt;script src="/mainapp/require.js" data-main="/mainapp/main"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="main-content"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>main.js</strong></p> <pre><code>require.config({...}) // Configure requires.js... require(["jquery", "cs!models/samplemodel", "cs!views/sampleview","cs!collections/samplecollection"], function ($, Model, View, Collection) { var collection = new Collection(); collection.fetch(); var view = new View({collection: collection}); $("body").html(view.render().$el); }) </code></pre> <p><strong>sampleview.coffee</strong></p> <pre><code>define ["backbone", "jquery", "handlebars","text!templates/sampleTemplate.hbs"], (Backbone, $, Hbs, template) =&gt; class MainView extends Backbone.View initialize: =&gt; @collection.on "change", @render @template = Hbs.compile template render: =&gt; html = @template {models: @collection.models} @$el.html(html) return @ </code></pre> <p><strong>sampleTemplate.hbs</strong></p> <pre><code>{{#models}} &lt;p&gt;{{name}}&lt;/p&gt; {{/models}} </code></pre> <p>Ok so that is the essential. Now you'll have to learn how to use <a href="http://backbonejs.org/#Collection">Backbone.Collection</a>, <a href="http://backbonejs.org/#Model">Backbone.Model</a>, how to configure <a href="http://requirejs.org/">Require.js</a>, how to configure <a href="http://passportjs.org/guide/configure/">Passport.js</a> and how to make a <a href="http://mongoosejs.com/docs/guide.html">Mongoose model</a>. You can use the <a href="https://github.com/emberfeather/less.js-middleware">Less middleware</a> to compile your style.less</p> <p>Don't forget that you can precompile all your client application with <a href="https://github.com/jrburke/r.js/">r.js</a>.</p> <p>Now I hope that this page will not be forgotten and that it will help anyone who come across it in the future.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload