Skip to content
web application framework for node built on express and, based on mauricemach/zappa
CoffeeScript HTML Shell
Pull request Compare This branch is 527 commits ahead, 1 commit behind shimaore:master.
Latest commit 043dc2f @shimaore shimaore 3.2.0

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

Build Status Dependency Status


require('zappajs') ->

  ## Server-side ##

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

  {doctype,html,head,title,script,link,body,h1,div} = @teacup
  @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':
      font: '12px Helvetica'
      color: 'pink'

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

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

  ## Client-side ##

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

  @client '/client.js': ->

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

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


npm install zappajs

Other resources

Something went wrong with that request. Please try again.