Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 45 lines (33 sloc) 1.124 kb
#!/usr/bin/env coffee
connect = require 'connect'
sharejs = require '../src/server'
sys = require 'sys'
server = connect(
connect.favicon(),
connect.logger(),
connect.static(__dirname + '/../examples'),
connect.router (app) ->
renderer = require '../examples/_static'
app.get '/static/:docName', (req, res, next) ->
docName = req.params.docName
renderer docName, server.model, res, next
wiki = require '../examples/_wiki'
app.get '/wiki/?', (req, res, next) ->
res.writeHead 301, {location: '/wiki/Main'}
res.end()
app.get '/wiki/:docName', (req, res, next) ->
docName = req.params.docName
wiki docName, server.model, res, next
app.get '/pad/?', (req, res, next) ->
docName = server.model.randomDocName()
res.writeHead 303, {location: '/pad/pad.html#' + docName}
res.end()
app.get '/?', (req, res, next) ->
res.writeHead 302, {location: '/index.html'}
res.end()
)
options = {db: {type:'memory'}}
# Attach the sharejs REST and Socket.io interfaces to the server
sharejs.attach server, options
server.listen 8000
sys.puts 'Demos running at http://localhost:8000/'
Jump to Line
Something went wrong with that request. Please try again.