Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
135 lines (114 sloc) 4.57 KB
What is this?
A RESTful framework for rapid development in marklogic server
Should I use it?
This is not usable - refer to RDBC for a proof of concept that actually works
currently cleaning up the code and adding more functionality
Next steps
- Make it work with defaults, doing something just to show
- Then generalize everything and program the generators
- Most likely in ruby
- Code the tests
- Most likely in cucumber, because miguel said its cool
- Then implement the caches
- To prevent the heavy calculations
- Add /_sessions folder
- Add method to sanitize input, or make it automatic with the generated
xml. Maybe sanitized inputs
- No layoutsÉ We need layouts or its just crazy
- Make a twitter like chat app (just for javscript)
- Improve code - too early stages and ugly
I'm trying to get ahead of you, but what's this cache thingy?
It's a mapping, that going to be stored in something like a persistent
memcached inside marklogic (using range indexes). This is how it looks like
for the sample routes that come with the instalation.
<d:cache xmlns:d="">
<d:kvp key="get /user/:id" value="/resources/user.xqy?_action=get"/>
<d:kvp key="post /user/:id" value="/resources/user.xqy?_action=post"/>
<d:kvp key="put /user/:id" value="/resources/user.xqy?_action=put"/>
<d:kvp key="delete /user/:id" value="/resources/user.xqy?_action=delete"/>
<d:kvp key="get /album/:id" value="/resources/album.xqy?_action=get"/>
<d:kvp key="post /album/:id" value="/resources/album.xqy?_action=post"/>
<d:kvp key="put /album/:id" value="/resources/album.xqy?_action=put"/>
<d:kvp key="delete /album/:id" value="/resources/album.xqy?_action=delete"/>
<d:kvp key="get /album/:id/songs" value="/resources/album.xqy?_action=songs"/>
<d:kvp key="get /feed"
<d:kvp key="get /logout" value="/resources/sessions.xqy?_action=delete"/>
<d:kvp key="get /activate/:key" value="/resources/user.xqy?_action=activate"/>
<d:kvp key="get /" value="/resources/album.xqy?_action=list"/>
<d:kvp key="get /:resource/:action/:id" value="/lib/dylan/invoke.xqy"/>
1) Supporting compression (gzip) would be nice for put, get and post
but requires a slightly more complicated client (and server)
2) Application level security allows protecting some calls while
leaving others unprotected
3) User agent to drive browsers to html and curl to xml
4) A memcached implementation
/_caches/_setup.xml -> stores things that are created on startup
/_caches/_routes.xml -> stores the routes
/_caches/_app.xml -> page cache for sweeping
create your own
5) Use directories in database to store those files
6) Introduce notion of tasks (spawns)
7) We need a restful way to address the admin api...
Maybe narthex, maybe the api itself as its already deployed in every
marklogic install (sounds like a good default)
Sample Invocations
1) Create file one.xml (you need an xml file named one.xml in the working directory)
curl \
--request POST \
--data "@one.xml" \
--anyauth \
2) Update file book.xml (you need an xml file named two.xml in the working directory)
curl \
--request PUT \
--data "@two.xml" \
--anyauth \
3) Get file book.xml in json
curl \
--header "Accept: application/json" \
--anyauth \
4) Get file book.xml
curl \
--anyauth \
5) Delete file one.xml
curl \
--request DELETE \
--anyauth \
6) An invalid route
curl \
--header "Accept: application/json" \
--anyauth \
document inserts
document { <album>
<title> A Dummy Album </title>
<artist> Jon Bon Jovi </artist>
<song> One </song>
<song> Two </song>
</album> }
document { <album>
<title> A Summer Album </title>
<artist> Brian Adams</artist>
<song> Yet </song>
<song> Another </song>
</album> }