Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actually make http requests #4

Closed
3 tasks done
alechenninger opened this issue Nov 12, 2014 · 1 comment
Closed
3 tasks done

Actually make http requests #4

alechenninger opened this issue Nov 12, 2014 · 1 comment
Assignees

Comments

@alechenninger
Copy link
Owner

  • Define an interface for an http dependency
  • Implement with node http (browserify will wrap XMLHttpRequest)
  • Implement with angular $http
@alechenninger
Copy link
Owner Author

Need to define a common API that Node.JS and Angular and regular frontend javascript can interface with. I think based off of q makes sense because angular already uses this and it can wrap callback based API's nicely (Node.JS http/https modules).

A first step would be an injectable http client dependency that clients could set up however they pleased. Something like:

Using angular:

module.service("lightblueData", ["$http", function($http) {
  var http = lightblue.http.ng($http);
  return new lightblue.DataClient(url, http);
]});

Using node / browserify:

var lightblue = require("lightblue");
var http = require("http");
var httpOptions = { 
  // setup auth options or w/e
};

var data = new lightblue.DataClient(url, http, httpOptions);

.... something like that. May need a config object with angular too for auth setup or other(?) setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant