935344b02244097a46234ba6b4cb162847a72913
[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 Data can also be serve static json files stored in:
30
31         public/json/:database/:entity/:key
32
33 which can be used to provide data using external stand-alone scripts.
34
35
36
37 Replication of data between instances using angular REST API can be done with:
38
39         # create local CouchDB database
40         curl -X PUT http://localhost:5984/test
41
42         ./angular-replicate.pl \
43                 http://dpavlin.getangular.com/data/conference \
44                 http://localhost:3000/data/test
45
46 Replication is currently good only for initial import of data since it doesn't
47 support incremental replication and dies if data is allready present.
48
49
50 Installation:
51
52         git submodule init
53         git submodule update
54
55 Optionally build angular to get single file download
56
57         cd public/angular
58         rake compile
59         cd -
60
61 Start it with:
62
63         ./angular-server.pl daemon --reload  
64
65
66 Angular examples available:
67
68 - template/Cookbook - examples from wiki working against github version of angular
69 - template/conferece - conference submission example using mojolicious REST API server
70 - public/app/conference - new application layout with latest example confernce submission
71
72         curl -X PUT http://localhost:5984/conference/_design/symposium \
73                 -d @public/app/conference/_design/symposium
74
75
76
77 CouchDB examples:
78
79         couchdb-changes.pl - simple _changes feed watcher using Mojo::Client documented at
80
81                 http://wiki.apache.org/couchdb/HTTP_database_API#Changes
82
83
84         couchdb-trigger.pl - FSM document with hook for user-defiend triggers
85
86                 trigger/shell.pm - execute shell commands
87                 trigger/email.pm - skeleton for sending e-email
88                 trigger/KinoSearch.pm - full-text search
89
90         $ curl -X PUT http://localhost:5984/trigger_demo
91         {"ok":true}
92
93         $ ./couchdb-trigger.pl http://localhost:5984/trigger_demo trigger/shell.pm
94
95         $ curl -X PUT http://localhost:5984/trigger_demo/t1 -d '{"trigger":{"command":"notify-send CouchDB t1"}}'
96
97
98         couchdb-external-kinosearch.pl - external searcher for KinoSearch indexes
99                 (configuration for CouchDB is included at end of file)
100
101         $ ./couchdb-trigger.pl http://localhost:5984/trigger_demo trigger/KinoSearch.pm
102
103         $ curl 'http://localhost:5984/trigger_demo/_kinosearch?include_docs=true;q=foobar'
104
105
106
107 Roadmap:
108
109 + implement angular-server.pl which implements REST API supported by $resource in angular
110 + persistency to local CouchDB, and use views to query data
111 + implement CouchDB _changes and FSM inside document as base for queue or triggers
112 - tests