Skip to content

Commit

Permalink
return JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Binsztok committed Nov 5, 2011
1 parent a627ade commit de5828d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/server.opa
Expand Up @@ -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])

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de5828d

Please sign in to comment.