Browse Source

new sample

Namdak Tonpa 9 years ago
parent
commit
ce45cf5758
4 changed files with 5 additions and 6 deletions
  1. 1 1
      include/mad.hrl
  2. BIN
      mad
  3. 1 2
      priv/web/apps/sample/src/index.erl
  4. 3 3
      priv/web/apps/sample/src/sample.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"a119fd").
+-define(VERSION,"e8b6cb").

BIN
mad


+ 1 - 2
priv/web/apps/sample/src/index.erl

@@ -4,8 +4,7 @@
 -include_lib("nitro/include/nitro.hrl").
 
 peer()    -> wf:to_list(wf:peer(?REQ)).
-message() -> wf:info("wf:q: ~p~n",[wf:q(message)]),
-             wf:js_escape(wf:html_encode(wf:to_list(wf:q(message)))).
+message() -> wf:js_escape(wf:html_encode(wf:to_list(wf:q(message)))).
 main()    -> #dtl{file="index",app=sample,bindings=[{body,body()}]}.
 body()    -> [ #panel{id=history}, #textbox{id=message},
                #button{id=send,body="Chat",postback=chat,source=[message]} ].

+ 3 - 3
priv/web/apps/sample/src/sample.erl

@@ -9,9 +9,9 @@ start(_,_) -> supervisor:start_link({local,sample},sample,[]).
 stop(_)    -> ok.
 init([])   -> case cowboy:start_http(http,3,port(),env()) of
                    {ok, _}   -> ok;
-                   {error,_} -> halt(abort,[]) end,
-                   {ok, {{one_for_one, 5, 10}, []}}.
+                   {error,_} -> halt(abort,[]) end, sup().
 
+sup()    -> { ok, { { one_for_one, 5, 100 }, [] } }.
 env()    -> [ { env, [ { dispatch, points() } ] } ].
 static() ->   { dir, "apps/sample/priv/static", mime() }.
 n2o()    ->   { dir, "deps/n2o/priv",           mime() }.
@@ -21,6 +21,6 @@ points() -> cowboy_router:compile([{'_', [
               { "/static/[...]", n2o_static, static() },
               { "/n2o/[...]",    n2o_static, n2o()    },
               { "/ws/[...]",     n2o_stream, []       },
-              { '_',             n2o_cowboy, []       } ]}]).
+              { '_',             n2o_cowboy, []       }]}]).
 
 log_modules() -> [n2o_client,n2o_nitrogen,n2o_stream,wf_convert].