[annotator-dev] Trouble setting up local storage

Gareth Highnam gareth862 at gmail.com
Mon Mar 9 22:13:38 UTC 2015


This time it gave 200 and gave me some JSON about my existing entries,
which are a bunch data like so:

{"_id":"54fdf51f18eb23d57f4a8ca6","quote":"are two solut","uri":"
http://localhost.com/inline/anno.html
","__v":0,"permissions":[],"tags":[],"ranges":[{"start":"/p[2]","startOffset":22,"end":"/p[2]","endOffset":36,"_id":"54fdf51f18eb23d57f4a8ca7"}],"text":"adsf","updated":"2015-03-09T19:31:43.016Z","created":"2015-03-09T19:31:43.016Z","id":"54fde1dbf7d884cc7862b346"},09T21:57:53.240Z","id":"54fde1dbf7d884cc7862b346"}]

I'm not really sure if these posts are created correctly in first place,
which could be a big issue but there are no explicit errors from Annotator
about it.

Thanks,
Gareth

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

> I missed that Annotator is successfully POSTing entries.  That narrows
> things down.
>
> What url is it GETing from?  When it returns 200 or 304, can you use the
> "Network -> Response" element of the developer console to inspect what it's
> returning?
>
> On Mon, Mar 9, 2015 at 5:55 PM, Gareth Highnam <gareth862 at gmail.com>
> wrote:
>
>> 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/b05165b7/attachment-0004.html>


More information about the annotator-dev mailing list