Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
web application framework for node built on express and socket.io, based on mauricemach/zappa
CoffeeScript HTML Other

This branch is 243 commits ahead, 1 commit behind shimaore:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
_layouts
benchmarks
docs
examples
lib
src
tests
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
Cakefile
LICENSE
README.md
index.md
package.json

README.md

Zappa is a CoffeeScript-optimized interface to Express and Socket.IO.

Synopsis

require('zappajs') ->

  # Server-side

  @get '/': ->
    @render 'index',
      title: 'Zappa!'
      scripts: '/zappa/Zappa.js /index.js /client.js'
      stylesheet: '/index.css'

  @view index: ->
    doctype 5
    html ->
      head ->
        title @title if @title
        for s in @scripts.split ' '
          script src: s
        link rel:'stylesheet', href:@stylesheet
      body ->
        h1 'Welcome to Zappa!'
        div id:'content'

  @css '/index.css':
    body:
      font: '12px Helvetica'
    h1:
      color: 'pink'

  @get '/:name/data.json': ->
    record =
      id: 123
      name: @params.name
      email: "#{@params.name}@example.com"
    @send record

  @on 'ready': ->
    console.log "Client #{@id} is ready and says #{@data}."

  # Client-side

  @coffee '/index.js': ->
    alert 'hi'

  @client '/client.js': ->
    @connect()

    $ =>
      @emit 'ready', 'hello'

    @get '#/': ->
      @app.swap 'Ready to roll!'

Install

npm install zappajs

This will install v0.4, which depends on Express 3.0. If you would rather use Express 2.5:

npm install zappajs@0.3

Learn More

Other resources

Build Status

Something went wrong with that request. Please try again.