Skip to content

Commit 612c517

Browse files
committed
Add an example to the README
1 parent ea9b102 commit 612c517

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,31 @@ Okioki is a Maori word, meaning: to rest.
66
This module makes it easy to create a RESTful data service. Simply
77
by define urls and SQL statements in the apache configuration file.
88

9+
Example apache config
10+
---------------------
11+
Below is part of an apache configuration file. The first part loads
12+
the module.
13+
The Location directive makes the /tautoru url under control of the okioki module.
14+
- The OkiokiConnectionInfo shows a postgresql connect string.
15+
- The OkiokiCommand gives http method, a regex url (under /tautoru) and optionally decoded argument names.
16+
- The OkiokiSQL sets the SQL statement to execute when the command matches, it also optionally
17+
allows for named SQL parameters (which are decoded from the url, query string, post parameter and cookies).
18+
- The OkiokiCSV sets the names (which matches the names in the select clause) of the columns to display.
19+
20+
<IfModule !mod_okioki.c>
21+
LoadModule okioki_module modules/mod_okioki.so
22+
</IfModule>
23+
24+
<Location /tautoru>
25+
SetHandler okioki-handler
26+
OkiokiConnectionInfo "host=localhost dbname=tautoru user=tautoru password=foobarbaz"
27+
28+
OkiokiCommand GET ^/test$
29+
OkiokiSQL "select id, name from otp_algorithm"
30+
OkiokiCSV id name
31+
32+
OkiokiCommand GET ^/test/([0-9]+)$ id
33+
OkiokiSQL "select name from otp_algorithm where id = $1" id
34+
OkiokiCSV name
35+
</Location>
936

0 commit comments

Comments
 (0)