The presentation @spikebrehm gave for the SF Node.js meetup group April 30 2013.
http://www.meetup.com/Node-js-Serverside-Javascripters-Club-SF/events/114998792/
18. Meteor: client/serer, but no
serer-side rendering; owns data
layer
Derby: client+serer rendering,
but owns data layer
Mojito: client+serer rendering,
but full stack, and... I.
24. JavaScript MVC on client & server
Backbone & Handlebars
BaseView, BaseModel, BaseCollection,
BaseApp, ClientRouter, ServerRouter...
Express middleware
Minimal glue between client & server
Wat it is.
26. Write application logic agnostic to
environment.
Library, not a framework.
Minimize if (server) {...} else {...}.
Hide complexity in library.
Talk to RESTful API.
No server-side DOM.
Simple Express middleware.
Design goals.
31. var User = require(‘app/models/user’);
var BaseView = require(‘rendr/shared/base/view’);
CommonJS using Stitch
On the server:
On the client:
var User = require(‘app/models/user’);
var BaseView = require(‘rendr/shared/base/view’);
34. • On server startup, parse routes file and mount as
Express routes
• GET /users/1337
• Router matches "/users/:id" to "users#show" with
params = {"id": 1337}
• Router finds controller:
require("app/controllers/users_controller")
• Router executes show action with params = {"id": 1337}
• The show action says to fetch User#1337 and use
UsersShowView view class
• Router instantiates new UsersShowView with data
• Router calls view.getHtml()
• Hands HTML to Express, which decorates with layout
and serves response
36. • On page load, Router parses routes file and mounts
Backbone routes
• pushState /users/1337
• Router matches "/users/:id" to "users#show" with
params = {"id": 1337}
• Router finds controller:
require("app/controllers/users_controller")
• Router executes show action with params = {"id": 1337}
• The show action says to fetch User#1337 and use
UsersShowView view class
• Router instantiates new UsersShowView with data
• Router calls view.render()
• Insert into DOM
37. • On page load, Router parses routes file and mounts
Backbone routes
• pushState /users/1337
• Router matches "/users/:id" to "users#show" with
params = {"id": 1337}
• Router finds controller:
require("app/controllers/users_controller")
• Router executes show action with params = {"id": 1337}
• The show action says to fetch User#1337 and use
UsersShowView view class
• Router instantiates new UsersShowView with data
• Router calls view.render()
• Insert into DOM
38. • On page load, Router parses routes file and mounts
Backbone routes
• pushState /users/1337
• Router matches "/users/:id" to "users#show" with
params = {"id": 1337}
• Router finds controller:
require("app/controllers/users_controller")
• Router executes show action with params = {"id": 1337}
• The show action says to fetch User#1337 and use
UsersShowView view class
• Router instantiates new UsersShowView with data
• Router calls view.render()
• Insert into DOM
39. v0.4.0: CoffeeScript -> JavaScript
Almost done abstracting out Handlebars,
supporting other templating languages
Example app with session handling
Recent
developments.
40. Share routing logic between client &
server.
Lazy load views, templates, etc as
needed.
Break down into smaller modules.
Much more...
TODO.
41. Find the right set of primitives and
abstractions for isomorphic JavaScript
apps
Catalyze an isomorphic JavaScript
movement within the community
Catalog the various approaches
Project goals.