mirror of
https://github.com/status-im/burnchart.git
synced 2025-03-03 19:40:52 +00:00
refactor out https to github
This commit is contained in:
parent
f095be9b1a
commit
516a1eac24
19
app.coffee
19
app.coffee
@ -8,6 +8,15 @@ options =
|
|||||||
path: "/repos/intermine/InterMine/issues"
|
path: "/repos/intermine/InterMine/issues"
|
||||||
method: "GET"
|
method: "GET"
|
||||||
|
|
||||||
|
getIssues = (callback) ->
|
||||||
|
https.request(options, (response) ->
|
||||||
|
if response.statusCode is 200
|
||||||
|
json = ""
|
||||||
|
response.on "data", (chunk) -> json += chunk
|
||||||
|
|
||||||
|
response.on "end", -> callback JSON.parse json
|
||||||
|
).end()
|
||||||
|
|
||||||
app = express.createServer()
|
app = express.createServer()
|
||||||
|
|
||||||
app.configure ->
|
app.configure ->
|
||||||
@ -34,16 +43,10 @@ app.configure 'production', ->
|
|||||||
|
|
||||||
# Routes
|
# Routes
|
||||||
app.get '/issues', (req, res) ->
|
app.get '/issues', (req, res) ->
|
||||||
https.request(options, (response) ->
|
getIssues (issues) ->
|
||||||
if response.statusCode is 200
|
|
||||||
json = ""
|
|
||||||
response.on "data", (chunk) -> json += chunk
|
|
||||||
|
|
||||||
response.on "end", ->
|
|
||||||
res.render 'issues',
|
res.render 'issues',
|
||||||
'issues': JSON.parse json
|
'issues': issues
|
||||||
, (html) -> res.send html, 'Content-Type': 'text/html', 200
|
, (html) -> res.send html, 'Content-Type': 'text/html', 200
|
||||||
).end()
|
|
||||||
|
|
||||||
app.listen 3000
|
app.listen 3000
|
||||||
console.log "Express server listening to port 3000"
|
console.log "Express server listening to port 3000"
|
Loading…
x
Reference in New Issue
Block a user