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

Add methods to change end point(s) #351

Closed
davelab6 opened this issue Jul 30, 2014 · 3 comments
Closed

Add methods to change end point(s) #351

davelab6 opened this issue Jul 30, 2014 · 3 comments

Comments

@davelab6
Copy link

Following #8 I'd like to suggest Hoodie add methods to allow web developers to allow users to choose their Hoodie API end points - that is, where their data is being remotely stored.

At the moment, the end point is used as the arg for the Hoodie() method:

hoodie = new Hoodie('http://server:port/_api');

And, maybe I missed it, but there seems no way for a user to choose another end point.

Perhaps something like this:

hoodie.endpointUpdate('http://server:port/_api');

Or perhaps this could have multiple end points:

hoodie.endpoint.add('http://server:port/_api');
hoodie.endpoint.remove('http://server:port/_api');
hoodie.endpoint.removeAll();
hoodie.endpoint.find();
hoodie.endpoint.findAll();

The ability to do so is already now very practical, since there are a few 'CouchDB as a Service' providers. Switching from the custom localStorage shim to PouchDB can make the choice of datastore providers even wider. Also, some users might want to turn off remote storage of their data and rely solely on localStorage.

I think this important because it is part of the answer to the challenge of 'Who does that server really serve?': Put all of copyleft free software web applications client-side, and make it easy to pick a server.

A 'Pick your datastore' preference seems important to me for every Web app with a political ideology of autonomy. You choose no store at all, or localhost, or a remote one that you own/control at the level that matters to you - the jurisdiction, the hardware, the property.

@gr2m
Copy link
Member

gr2m commented Jul 30, 2014

hoodie = new Hoodie('http://server:port/_api');

You actually just need hoodie = new Hoodie('http://server:port');, the /_api part gets added automatically.

I don't understand the problem yet. If you want to build an app that connects to different Hoodie Endpoints, why not put that into the app's logic and ask the user to put in a URL that can be stored locally and be used in future to initialize hoodie new(customUrl).

Please clarify

@davelab6
Copy link
Author

davelab6 commented Aug 2, 2014

the /_api part gets added automatically.

Its given in the example on the homepage :)

I was thinking of an app changing end points after hoodie is initialized.

@gr2m
Copy link
Member

gr2m commented Aug 4, 2014

@davelab6 you can pass a full URL to hoodie.request or hoodie.open. I don't see a use case why you'd like to change the endpoint after Hoodie got initialized.

@gr2m gr2m closed this as completed Sep 23, 2014
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

3 participants