-module(async_app).
-behaviour(application).
-export([start/2]).
-export([stop/1]).
start(_Type, _Args) ->
table:new(table(), [named_table, public, set]),
Dispatch = cowboy_router:compile([
{'_', [{"/api/tasks/[:task_id]", async_handler, #{table => table()}}]}
]),
{ok, _} = cowboy:start_clear(
http_listener,
[{port, 8080}],
#{env => #{dispatch => Dispatch}}
),
async_sup:start_link().
stop(_State) ->
ok.
%% internal.
table() -> workloads_async.