Compare commits

..

No commits in common. "35082a748be6fbe6a0010774e4b4556fe9e4d278" and "e4ab8223865d75dac930d49c91d0317823198423" have entirely different histories.

3 changed files with 5 additions and 21 deletions

View File

@ -25,6 +25,10 @@ init(Req0, Opts) ->
}, Resp, Req1), }, Resp, Req1),
{ok, Req2, Opts}. {ok, Req2, Opts}.
%%
handle_request("GET", "/api/health_check", _) ->
{ok, 200, <<"OK">>};
%% %%
handle_request("POST", "/api/device_info/storeInfo", ReqBody) when is_binary(ReqBody) -> handle_request("POST", "/api/device_info/storeInfo", ReqBody) when is_binary(ReqBody) ->
#{<<"storeInfos">> := StoreInfos} = jiffy:decode(ReqBody, [return_maps]), #{<<"storeInfos">> := StoreInfos} = jiffy:decode(ReqBody, [return_maps]),

View File

@ -1,19 +0,0 @@
%%%-------------------------------------------------------------------
%%% @author licheng5
%%% @copyright (C) 2020, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 26. 4 2020 3:36
%%%-------------------------------------------------------------------
-module(health_handler).
-author("licheng5").
%% API
-export([init/2]).
init(Req0, Opts) ->
Req1 = cowboy_req:reply(200, #{
<<"Content-Type">> => <<"text/plain">>
}, <<"OK">>, Req0),
{ok, Req1, Opts}.

View File

@ -35,8 +35,7 @@ start_http_server() ->
Dispatcher = cowboy_router:compile([ Dispatcher = cowboy_router:compile([
{'_', [ {'_', [
{"/api/device_info/[...]", api_handler, []}, {"/api/device_info/[...]", api_handler, []}
{"/health_check", health_handler, []}
]} ]}
]), ]),