Permalink
Browse files

return JSON

  • Loading branch information...
1 parent a627ade commit de5828d4e9899c474e27c50d1663c3ad708df678 Henri Binsztok committed Nov 5, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 server/server.opa
View
@@ -30,6 +30,9 @@ db /wiki[_] = empty_page
do jlog("save = topic:{topic} version:{version}")
do /wiki[topic] <- page
void
+@public get_version() =
+ json = { Int = get_global() } : RPC.Json.json
+ Json.serialize(json)
remove_topic(topic) = Db.remove(@/wiki[topic])
@@ -68,7 +71,7 @@ dispatch(uri) =
| {path=["_list_" | _] ~query fragment=_ is_directory=_ is_from_root=_} ->
Resource.raw_response("{get_callback(query)}({list_topics()})", "text/javascript", {success})
| {path=["_version_" | _] ~query fragment=_ is_directory=_ is_from_root=_} ->
- Resource.raw_response("{get_callback(query)}({get_global()})", "text/javascript", {success})
+ Resource.raw_response("{get_callback(query)}({get_version()})", "text/javascript", {success})
| {path=["_rest_" | topic ] ~query fragment=_ is_directory=_ is_from_root=_} ->
// todo: separate topic, version
rest(topic_of_path(topic), get_callback(query), 0)

0 comments on commit de5828d

Please sign in to comment.