Hey Andrew,
I'm guessing your wanting to use the HTTP Storage implementation (since you
mention endpoint configuration). If that guess is correct, you would do it
something like this:
```
anno.setStorage(function() {
return new HTTPStorage({
prefix: '/url/to/your/endpoint'
});
});
```
Essentially, setStorage expects a function that will return a storage
implementation (which amounts to an object with functions for create,
update, delete, and query; see the DebugStorage code [1] for a simple
example). HTTPStorage ships with annotator and assumes that you're using
something compatible with the annotator-store project [2].
So, in effect, you create a new HTTPStorage object inside a closure that
setStorage will use when it sets things up for create, update, etc.
The indirection can be a little confusing, but it does provide a way for
you to test your storage code without any additional setup (as they're
generally just plain JS functions and objects.
Hope that helps!
Benjamin
[1]
https://github.com/openannotation/annotator/blob/master/src/storage.js#L19
[2] https://github.com/openannotation/annotator-store
On Sun, Jan 25, 2015 at 10:06 PM, andrew simpson <[email protected]>
wrote:
> I've been trying to look through example HTML files and storage.js
> implementation for details of how to specify a remote storage service
> for annotator2 (master), but haven't found a clear one yet.
>
> I can see this in dev.html, but so far seen nothing that corresponds to
> endpoint configuration - is this available?
>
> var Annotator = require('annotator'),
> elem = document.getElementById('airlock'),
> anno = new Annotator(elem);
> anno.addPlugin(Annotator.Plugin.Filter());
> anno.setStorage(Annotator.Storage.DebugStorage);
>
> Thanks...
>
> _______________________________________________
> annotator-dev mailing list
> [email protected]
> https://lists.okfn.org/mailman/listinfo/annotator-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>
>
_______________________________________________
annotator-dev mailing list
[email protected]
https://lists.okfn.org/mailman/listinfo/annotator-dev
Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev