A backend storage for the Annotator, based on PHP/Silex and SQLite. You can see the demo of how Annotator works.
A single annotator-store-lite instance can be used for multiple annotated Web pages on the same host. The storage relates the annotations to the page URI-s that they originate from, relying on the HTTP Referer header sent with the AJAX request saving an annotation object.
Sample nginx configuration:
location /annotator-store-lite/ {
root /srv/www/annotator-store-lite/www;
try_files $uri $uri/ @annotatorstore;
}
location @annotatorstore {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /srv/www/annotator-store-lite/www/index.php;
fastcgi_param REQUEST_URI $uri;
rewrite ^/annotator-store-lite/(.*)$ /$1 break;
}
location ~ \.php$ {
return 404;
}
Add the CONFIG, initialize the database:
$ cd /srv/www/annotator-store-lite
$ cp ./CONFIG.sample.json ./CONFIG.json
$ php ./scripts/init_db.php
./CONFIG.json
: sets the apiRootUrlWithoutTrailingSlash
to /annotator-store-lite
-- the storage
Web application's "mount" path.
Include the <script>
elements from
www/demo/index.html
into your Web page. You'll probably find it easier to use Bower package manager
to fetch all the JS
dependencies, just as
the demo page does.
-
Install VirtualBox and Vagrant
-
Run
~/prj/annotator-store-lite(master)$ vagrant up && vagrant ssh
vagrant@vagrant-ubuntu-raring-64:/vagrant$ ./vendor/bin/phpunit
http://localhost:8080/demo/
- Functional Annotator Store API (without search)
- A working demo page with the front-end plugged in
- Multi-page support via URI-s and HTTP Referer
- Use bower for the demo page dependencies
- Switch to the Ubuntu official 13.04 amd64 box under Vagrant
- Improved Vagrant/SaltStack setup
- dbFilePath config value introduced