[annotator-dev] Trouble setting up local storage

Gareth Highnam gareth862 at gmail.com
Mon Mar 9 21:55:28 UTC 2015


Thanks Shauna,

When the loadFromSearch runs, it returns either a 304 or 200 type error.
Because of this, it does not report anything to the developer console. Why
it does one or the other I still don't know...  You may be onto something
with the port issues though.

The confusing part is the lack of obvious errors. Store seems to POST fine,
but does not GET from search even with a 200 error.

Gareth



On Mon, Mar 9, 2015 at 4:40 PM, Shauna Gordon-McKeon <shaunagm at gmail.com>
wrote:

> I'm an Annotator newb too, but a few things I notice:
>
> - You've given a full path when specifying the endpoint.  In my (working)
> version I just specify the prefix, in my case '/api'
>
> - You've specified :3000 for the api endpoint but not for the URIs.  If
> the whole app is accessed via port 3000 this may cause problems.
>
> - You've got a term search:  '/search' here which I don't have.  This
> could totally be a working different implementation from mine, but I
> thought I'd flag it as a potential problem.  I've put my code here in
> case it's helpful to look through: https://pastebin.mozilla.org/8824977
>
> Maybe try switching the above things around and see if it starts working?
>
> When debugging problems, I use the developer console that Chrome/Firefox
> provide.  You can see network requests there.  Annotator should be making a
> request to the API store -- what is the response from the API?  404 (not
> found)?  403 (forbidden)?  Or is it breaking before it even makes a request?
>
> best
> Shauna
>
>
>
>
>
>
>
>
> On Mon, Mar 9, 2015 at 5:09 PM, Gareth Highnam <gareth862 at gmail.com>
> wrote:
>
>> I've been tying to set up local storage with the storage plugin, using
>> Node.js+MongoDB. My end goal is for anyone visiting my page to be able to
>> annotate it and view any existing annotations previously made, when the
>> page loads. I don't need any authentication for this purpose.
>>
>> Disclaimer: (I am a noob)
>>
>> Here is where I am:
>> 1. Page loads, annotator can highlight, create, edit, delete comments on
>> front end.
>> 2. Annotator POST can create entries in back end.
>>
>> When I reload page, no stored annotations are brought up, despite
>> existing in backend. Here is the code for the storage set up:
>>
>> var content = $('div').annotator();
>>
>> content.annotator('addPlugin', 'Store', {
>>
>>         // The endpoint of the store on your server.
>>                                            prefix: '
>> http://www.nofeveryone.com:3000/inline',
>>
>>             // Attach the uri of the current page to all annotations to
>> allow search.
>>
>>
>>             annotationData: {
>>
>>             'uri': 'http://www.nofeveryone.com/anno/anno.html'
>>
>>                 },
>>
>>
>>             // This will perform a "search" action when the plugin
>> loads. Will
>>
>>             // request the last 20 annotations for the current url.
>>                                              // eg.
>> /store/endpoint/search?limit=20&uri=http://this/document/only
>>           loadFromSearch: {
>>
>>             'limit': 20,
>>
>>                 'uri': 'http://www.nofeveryone.com/anno/anno.html'
>>
>>                 },
>>
>>             urls: {
>>
>>                  search:  '/search'
>>
>>                 }
>>
>>     });
>>
>> The API endpoints appear fully functional. When I test the same http
>> requests from my URI using curl, I get my posts back in JSON.
>>
>> I've been pretty stumped for why it's not loading them with
>> "loadFromSearch", so if anyone thinks they can help I would greatly
>> appreciate it. I'm happy to give any other info about my code.
>>
>> Gareth
>>
>>
>>
>> _______________________________________________
>> annotator-dev mailing list
>> annotator-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/annotator-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20150309/967119ca/attachment-0003.html>


More information about the annotator-dev mailing list