public
Description: This is a simple example of how to provide an HTTP api to Scalaris via Mochiweb
Homepage: http://weblog.miceda.org
Clone URL: git://github.com/davebryson/mochiweb_scalaris.git
100644 35 lines (21 sloc) 1.14 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
This is a simple example of how to provide an HTTP api to Scalaris via Mochiweb.
 
(note: this code originally lived on Google Code. Moved to github)
 
Requirements:
 - Scalaris (http://code.google.com/p/scalaris/)
 - Mochiweb (http://code.google.com/p/mochiweb/)
 - Erlang R12.x
 
Build:
 - Make a softlink to the MochiWeb ebin files in the deps directory
 - run "make" in this directory
 
Setup:
 1. Start Scalaris on your machine. See the README file in the Scalaris source.
 2. In the "start-dev.sh" script set the BOOT_NODE variable to the name of the Scalaris boot node ("boot@localhost")
 3. If you changed the -setcookie value on Scalaris, set it to the new value in "start-dev.sh"
 
Start it up!
 - run "./start-dev.sh" in another terminal
 
How it works:
  - To store a Key:Value on Scalaris: Send a post (or get) to:
     "http://localhost:8002/scalaris/write" with the parameters: key="your key", value="the value"
  - To read a value from Scalaris: Send a get to:
      "http://localhost:8002/scalaris/read" with the parameters: key="your key"
 
 
See "simple_messaging_scalaris_web.erl" and "scalaris_proxy.erl" for more info.