Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Use dynamic http handlers
We use dynamic http handlers for:

  - `_membership`
  - `_shards`
  • Loading branch information
iilyak committed Jul 17, 2015
1 parent fb5f56c commit a8cf4dff133ecf4421eb585141f6fe347dbf9be2
Showing 3 changed files with 26 additions and 1 deletion.
@@ -43,6 +43,7 @@
sasl,
crypto,
mochiweb,
couch_epi,
couch,
rexi,
couch_log,
@@ -0,0 +1,23 @@
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
% License for the specific language governing permissions and limitations under
% the License.

-module(mem3_httpd_handlers).

-export([url_handler/1, db_handler/1, design_handler/1]).

url_handler(<<"_membership">>) -> fun mem3_httpd:handle_membership_req/1;
url_handler(_) -> no_match.

db_handler(<<"_shards">>) -> fun mem3_httpd:handle_shards_req/2;
db_handler(_) -> no_match.

design_handler(_) -> no_match.
@@ -23,7 +23,8 @@ init(_Args) ->
child(mem3_nodes),
child(mem3_sync_nodes), % Order important?
child(mem3_sync),
child(mem3_shards)
child(mem3_shards),
chttpd_handlers:provider(mem3, mem3_httpd_handlers)
],
{ok, {{one_for_one,10,1}, Children}}.

0 comments on commit a8cf4df

Please sign in to comment.