This web framework tries to get the best from 2 worlds: traditional and single-page websites.
$ npm install onecode
OneCode builds on the single-page website (rich web client) architecture consisting of 2 major parts:
OneCode helps running the second part both on client and on the server effectively:
# This is a main.coffee file, standard Express boilerplate.express = require 'express'browserify = require 'browserify'onecode = require 'onecode'app = expresscreateServer# Make ./client_script/index.coffee (and all dependent modules) accessible to the client as '/main.js'appuse browserify mount: 'main.js'entry: './client_script/index.coffee'# Make the same file work in server environment and prepare to serve requests# according to Backbone routes.appuse onecode require'./client_script/index.coffee'applisten 3000
# ./client_script/index.coffee: works both on client and server.OneCode = require 'onecode/client'OneCodeexportToGlobals # This makes 'Backbone', '_', 'OneCode', '$' accessible globally.# The app has everything to render on server and continue working with it on client.# It is created on every server request.: ->
(Sample apps: http://addyosmani.github.com/todomvc/)