fix
This commit is contained in:
parent
b0e5cbc0cd
commit
394ebe67cc
@ -31,6 +31,16 @@ handle_request("GET", "/endpoint/all", GetParams, _) ->
|
|||||||
|
|
||||||
{ok, 200, iot_util:json_data(EndpointInfos)};
|
{ok, 200, iot_util:json_data(EndpointInfos)};
|
||||||
|
|
||||||
|
%% 可以根据name进行过滤
|
||||||
|
handle_request("GET", "/endpoint/info", #{<<"name">> := Name}, _) ->
|
||||||
|
case mnesia_endpoint:get_endpoint(Name) of
|
||||||
|
{ok, Endpoint} ->
|
||||||
|
EndpointInfo = mnesia_endpoint:to_map(Endpoint),
|
||||||
|
{ok, 200, iot_util:json_data(EndpointInfo)};
|
||||||
|
undefined ->
|
||||||
|
{ok, 200, iot_util:json_error(404, <<"not found">>)}
|
||||||
|
end;
|
||||||
|
|
||||||
%% 重新加载对应的主机信息
|
%% 重新加载对应的主机信息
|
||||||
handle_request("POST", "/endpoint/create", _, Params = #{<<"name">> := Name}) ->
|
handle_request("POST", "/endpoint/create", _, Params = #{<<"name">> := Name}) ->
|
||||||
RequiredFields = [<<"name">>, <<"title">>, <<"matcher">>, <<"mapper">>, <<"config">>],
|
RequiredFields = [<<"name">>, <<"title">>, <<"matcher">>, <<"mapper">>, <<"config">>],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user