fix binlog
This commit is contained in:
parent
bcfcbcbd1d
commit
fef8247944
30
apps/sdlan/src/http_handler/binlog_handler.erl
Normal file
30
apps/sdlan/src/http_handler/binlog_handler.erl
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
%%% @author licheng5
|
||||||
|
%%% @copyright (C) 2020, <COMPANY>
|
||||||
|
%%% @doc
|
||||||
|
%%%
|
||||||
|
%%% @end
|
||||||
|
%%% Created : 26. 4月 2020 3:36 下午
|
||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
-module(binlog_handler).
|
||||||
|
-author("licheng5").
|
||||||
|
|
||||||
|
%% API
|
||||||
|
-export([handle_request/4]).
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%% helper methods
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
%% 重新加载对应的主机信息
|
||||||
|
handle_request("POST", "/binlog", _, PostParams) ->
|
||||||
|
logger:debug("[binlog_handler] get post params: ~p", [PostParams]),
|
||||||
|
{ok, 200, sdlan_util:json_data(<<"ok">>)};
|
||||||
|
|
||||||
|
handle_request(_, Path, _, _) ->
|
||||||
|
Path1 = list_to_binary(Path),
|
||||||
|
{ok, 200, sdlan_util:json_error(-1, <<"url: ", Path1/binary, " not found">>)}.
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%% helper methods
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@ -38,6 +38,7 @@ start_http_server() ->
|
|||||||
Dispatcher = cowboy_router:compile([
|
Dispatcher = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
{"/api/[...]", http_protocol, [api_handler]},
|
{"/api/[...]", http_protocol, [api_handler]},
|
||||||
|
{"/binlog", http_protocol, [binlog_handler]},
|
||||||
{"/network/[...]", http_protocol, [network_handler]},
|
{"/network/[...]", http_protocol, [network_handler]},
|
||||||
{"/node/[...]", http_protocol, [node_handler]},
|
{"/node/[...]", http_protocol, [node_handler]},
|
||||||
{"/test/[...]", http_protocol, [test_handler]}
|
{"/test/[...]", http_protocol, [test_handler]}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user