Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 135 lines (114 sloc) 4.678 kb
9a5f70f Nuno Job first commit
authored
1 What is this?
2 ''''''''''''
3 A RESTful framework for rapid development in marklogic server
4
5 Should I use it?
6 '''''''''''''''
7 This is not usable - refer to RDBC for a proof of concept that actually works
8 currently cleaning up the code and adding more functionality
9
b927856 Nuno Job Updated next steps
authored
10 Next steps
11 ''''''''''
12 - Make it work with defaults, doing something just to show
13 - Then generalize everything and program the generators
14 - Most likely in ruby
15 - Code the tests
16 - Most likely in cucumber, because miguel said its cool
17 - Then implement the caches
18 - To prevent the heavy calculations
ba3995a Added some new ideas to readme file
Nuno Job authored
19 - Add /_sessions folder
20 - Add method to sanitize input, or make it automatic with the generated
21 xml. Maybe sanitized inputs
5ce3e6b Added some new ideas to readme file
Nuno Job authored
22 - No layoutsÉ We need layouts or its just crazy
ee5e2f5 Nuno Job should call this framework airplane - thats where the development happen...
authored
23 - Make a twitter like chat app (just for javscript)
24 - Improve code - too early stages and ugly
b927856 Nuno Job Updated next steps
authored
25
26
3aa9b73 Nuno Job Added support for images and css
authored
27 I'm trying to get ahead of you, but what's this cache thingy?
28 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
29 It's a mapping, that going to be stored in something like a persistent
30 memcached inside marklogic (using range indexes). This is how it looks like
31 for the sample routes that come with the instalation.
32
33 <d:cache xmlns:d="http://ns.dscape.org/2010/dylan/core">
34 <d:kvp key="get /user/:id" value="/resources/user.xqy?_action=get"/>
35 <d:kvp key="post /user/:id" value="/resources/user.xqy?_action=post"/>
36 <d:kvp key="put /user/:id" value="/resources/user.xqy?_action=put"/>
37 <d:kvp key="delete /user/:id" value="/resources/user.xqy?_action=delete"/>
38 <d:kvp key="get /album/:id" value="/resources/album.xqy?_action=get"/>
39 <d:kvp key="post /album/:id" value="/resources/album.xqy?_action=post"/>
40 <d:kvp key="put /album/:id" value="/resources/album.xqy?_action=put"/>
41 <d:kvp key="delete /album/:id" value="/resources/album.xqy?_action=delete"/>
42 <d:kvp key="get /album/:id/songs" value="/resources/album.xqy?_action=songs"/>
43 <d:kvp key="get /feed"
44 value="/lib/dylan/redirect.xqy?url=http%3a//feedburner.com/sample_feed"/>
45 <d:kvp key="get /logout" value="/resources/sessions.xqy?_action=delete"/>
46 <d:kvp key="get /activate/:key" value="/resources/user.xqy?_action=activate"/>
47 <d:kvp key="get /" value="/resources/album.xqy?_action=list"/>
48 <d:kvp key="get /:resource/:action/:id" value="/lib/dylan/invoke.xqy"/>
49 </d:cache>
50
9a5f70f Nuno Job first commit
authored
51 Ideas
52 '''''
53 1) Supporting compression (gzip) would be nice for put, get and post
54 but requires a slightly more complicated client (and server)
55 2) Application level security allows protecting some calls while
56 leaving others unprotected
57 3) User agent to drive browsers to html and curl to xml
58 4) A memcached implementation
59 /_caches/song.xml
60 /_caches/_setup.xml -> stores things that are created on startup
61 /_caches/_routes.xml -> stores the routes
62 /_caches/_app.xml -> page cache for sweeping
63 /_caches/_consistenthash.xml
64 create your own
65 5) Use directories in database to store those files
66 6) Introduce notion of tasks (spawns)
67 7) We need a restful way to address the admin api...
68 Maybe narthex, maybe the api itself as its already deployed in every
69 marklogic install (sounds like a good default)
70
71 Sample Invocations
72 ''''''''''''''''''
73
74 1) Create file one.xml (you need an xml file named one.xml in the working directory)
75
76 curl \
77 --request POST \
78 --data "@one.xml" \
79 --anyauth \
80 http://user:pwd@localhost:8010/doc/one.xml
81
82 2) Update file book.xml (you need an xml file named two.xml in the working directory)
83
84 curl \
85 --request PUT \
86 --data "@two.xml" \
87 --anyauth \
88 http://user:pwd@localhost:8010/doc/one.xml
89
90 3) Get file book.xml in json
91
92 curl \
93 --header "Accept: application/json" \
94 --anyauth \
95 http://user:pwd@localhost:8010/doc/one.xml
96
97 4) Get file book.xml
98
99 curl \
100 --anyauth \
101 http://user:pwd@localhost:8010/doc/one.xml
102
103 5) Delete file one.xml
104
105 curl \
106 --request DELETE \
107 --anyauth \
108 http://user:pwd@localhost:8010/doc/one.xml
109
110 6) An invalid route
111
112 curl \
113 --header "Accept: application/json" \
114 --anyauth \
115 http://user:pwd@localhost:8010
85b75d7 in plane developments
Nuno Job authored
116
117 document inserts
118 ''''''''''''''''
119 xdmp:document-insert("/album/bon+jovi-a+dummy+album.xml",
120 document { <album>
121 <title> A Dummy Album </title>
122 <artist> Jon Bon Jovi </artist>
123 <song> One </song>
124 <song> Two </song>
125 </album> }
126 );
127 xdmp:document-insert("/album/brian+adams-a+summer+album.xml",
128 document { <album>
129 <title> A Summer Album </title>
130 <artist> Brian Adams</artist>
131 <song> Yet </song>
132 <song> Another </song>
133 </album> }
134 )
Something went wrong with that request. Please try again.