Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fredericksilva/9c57661688ee490abad6 to your computer and use it in GitHub Desktop.
Save fredericksilva/9c57661688ee490abad6 to your computer and use it in GitHub Desktop.
Simple backend class example.
class Backend
getData: ->
request = $.ajax
type: "GET"
dataType: "JSON"
url: '/foo'
request.pipe (response) ->
DomainObject.fromJSON(response)
# And then in initializer code:
@backend.getData()
.done (domainObject) =>
# Do something. For example: set state of the component you've rendered before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment