Skip to content

Commit

Permalink
update config, and cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Annabel Church committed Aug 11, 2013
1 parent 496368e commit 35673f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/config.coffee
Expand Up @@ -32,6 +32,5 @@ exports.getTable = (callback) ->
tabletop.init
key: exports.gdoc_key
simpleSheet: true
callback: (d,h) ->
callback d, h
callback: callback

9 changes: 8 additions & 1 deletion live.coffee
Expand Up @@ -67,6 +67,12 @@ app = createApp
generateStatistics: (cb) -> cb {}
getLatest: (cb) -> cb {}

app.all '/*', (req, res, next) ->
res.set "Access-Control-Allow-Origin", "*"
res.set "Access-Control-Allow-Headers", "X-Requested-With"
next()


app.get '/votes', (req, res) ->
if not req.query.event or not votemanager.events[req.query.event]?
return res.jsonp 400,
Expand All @@ -84,7 +90,8 @@ app.get '/votes', (req, res) ->
my_latest = new Date(row.sample)
if my_latest > latest
latest = my_latest
latest = latest.getTime()
if latest isnt null
latest = latest.getTime()
etag = "#{req.query.event}-#{length}-#{freq}-#{latest}"
res.set
'ETag': etag
Expand Down

0 comments on commit 35673f0

Please sign in to comment.