Skip to content

Instantly share code, notes, and snippets.

@esehara
Created October 15, 2011 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esehara/1289638 to your computer and use it in GitHub Desktop.
Save esehara/1289638 to your computer and use it in GitHub Desktop.
さーばーさいとじゃばすくりぷと
require.paths.push("/usr/local/lib/node_modules")
express = require "express"
app = express.createServer()
hamljs = require "hamljs"
coffee = require "coffee-script"
io = require("socket.io").listen(app)
io.configure () ->
io.set "transports",["xhr-polling"]
io.set "polling duration",10
hamljs.filters.coffee = (str) ->
@javascript coffee.compile(str)
io.sockets.on "connection",(socket) ->
console.log "connected"
socket.on "msg send",(msg) ->
socket.emit "msg push",msg
socket.broadcast.emit "msg push",msg
socket.on "disconnect",() ->
console.log "disconnected"
app.use express.static(__dirname + "/public")
app.register ".haml",require("hamljs")
app.get "/", (req,res) ->
res.render "index.html.haml"
app.listen process.env.PORT || 3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment