Skip to content

Instantly share code, notes, and snippets.

@pyykkis
Last active December 19, 2015 09:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyykkis/5936763 to your computer and use it in GitHub Desktop.
Save pyykkis/5936763 to your computer and use it in GitHub Desktop.
module.exports = class FooController
get: ({params: {foo}}, res) ->
get("http://localhost:9292/api/#{foo}.json")
.then (response) ->
res.status response.status
if response.status == 200
then res.end JSON.stringify transformResponse response.body
else res.end response.text
.catch -> logger.warning("Couldn't connect to local proxy"); res.status(500); res.end()
.done()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment