we need to delete document before each update
[angular-mojolicious.git] / README
1 REST JSONP server using mojolicious for <angular/>
2
3
4 <angular/>: Complex web apps made simple
5 http://angularjs.org/
6
7
8 mojolicious: the web in the box!
9 http://mojolicious.org/
10
11
12 This is my attempt to implement REST API described at:
13
14 http://docs.getangular.com/REST.Basic
15
16 using CouchDB HTTP view API
17
18 http://wiki.apache.org/couchdb/HTTP_view_API
19
20 to provide storage for experimenting with local datasets using angular $resource API.
21 You can also query CouchDB views $xhr("JSON", ...) in angular through angular-server.pl
22
23
24 At it's current stage it provides support for angular $resource get, query and $save
25
26 http://angularjs.org/Service:$resource
27
28
29 Replication of data between instances using angular REST API can be done with:
30
31         # create local CouchDB database
32         curl -X PUT http://localhost:5984/test
33
34         ./angular-replicate.pl \
35                 http://dpavlin.getangular.com/data/conference \
36                 http://localhost:3000/data/test
37
38 Replication is currently good only for initial import of data since it doesn't
39 support incremental replication and dies if data is allready present.
40
41
42 Installation:
43
44         git submodule init
45         git submodule update
46
47 Optionally build angular to get single file download
48
49         cd public/angular
50         rake compile
51         cd -
52
53 Start it with:
54
55         ./angular-server.pl daemon --reload  
56
57
58 Angular examples available:
59
60 - template/Cookbook - examples from wiki working against github version of angular
61 - template/conferece - conference submission example using mojolicious REST API server
62 - public/app/conference - new application layout with latest example confernce submission
63
64         curl -X PUT http://localhost:5984/conference/_design/symposium \
65                 -d @public/app/conference/_design/symposium
66
67
68
69 CouchDB examples:
70
71         couchdb-changes.pl - simple _changes feed watcher using Mojo::Client documented at
72
73                 http://wiki.apache.org/couchdb/HTTP_database_API#Changes
74
75
76         couchdb-trigger.pl - FSM document with hook for user-defiend triggers
77
78                 trigger/shell.pm - execute shell commands
79                 trigger/email.pm - skeleton for sending e-email
80                 trigger/KinoSearch.pm - full-text search
81
82         $ curl -X PUT http://localhost:5984/trigger_demo
83         {"ok":true}
84
85         $ ./couchdb-trigger.pl http://localhost:5984/trigger_demo trigger/shell.pm
86
87         $ curl -X PUT http://localhost:5984/trigger_demo/t1 -d '{"trigger":{"command":"notify-send CouchDB t1"}}'
88
89
90         couchdb-external-kinosearch.pl - external searcher for KinoSearch indexes
91                 (configuration for CouchDB is included at end of file)
92
93
94 Roadmap:
95
96 + implement angular-server.pl which implements REST API supported by $resource in angular
97 + persistency to local CouchDB, and use views to query data
98 + implement CouchDB _changes and FSM inside document as base for queue or triggers
99 - tests