|
@@ -11,13 +11,20 @@
|
|
|
%% API.
|
|
|
|
|
|
start(_Type, _Args) ->
|
|
|
+ crypto:start(),
|
|
|
+ application:start(emysql),
|
|
|
application:start(jiffy),
|
|
|
+ emysql:add_pool(test_pool, 5,
|
|
|
+ "benchmarkdbuser", "benchmarkdbpass", "localhost", 3306,
|
|
|
+ "hello_world", utf8),
|
|
|
+ emysql:prepare(db_stmt, <<"SELECT * FROM World where id = ?">>),
|
|
|
Dispatch = cowboy_router:compile([
|
|
|
{'_', [
|
|
|
- {"/json", toppage_handler, []}
|
|
|
+ {"/json", json_handler, []},
|
|
|
+ {"/db", db_handler, []}
|
|
|
]}
|
|
|
]),
|
|
|
- {ok, _} = cowboy:start_http(http, 200, [{port, 8080}], [
|
|
|
+ {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
|
|
|
{env, [{dispatch, Dispatch}]}
|
|
|
]),
|
|
|
hello_world_sup:start_link().
|