Source

webcandy / src / webmstn_notes_resource.erl

The default branch has multiple heads

Diff from to

File src/webmstn_notes_resource.erl

 
 -include_lib("webmachine/include/webmachine.hrl").
 
-init([]) -> {ok, undefined}.
+init([]) -> {ok, undefined};
+init([Cfg]) -> 
+    {trace_dir,Dir} = Cfg,
+	AbsDir =filename:absname(Dir), 
+	io:format("= = = = = = ~nnotes_resource Cfg=~p,  absdir=~p~n",[Cfg,AbsDir]),
+	{{trace,AbsDir}, Cfg}.
 
 content_types_provided(RD,Ctx) ->
     {[{"application/json",to_json}],RD,Ctx}.
     {true, RD, Ctx}.
 
 process_post(RD,Ctx) ->
-    io:format("--> process_post~n"),
+%   io:format("--> process_post~n"),
     Data = mochiweb_util:parse_qs(wrq:req_body(RD)),
     io:format("--> process_post Data:~n~p~n",[Data]),
     Struct = mochijson2:decode(proplists:get_value("json", Data)),
 %    io:format("--> process_post Act:~n~p~n",[Act]),
     RD1 = wrq:set_resp_header("Content-Type", "application/json",RD),
     Ans = mochijson2:encode(notes:Act(Struct)),
+    io:format("--> process_post DB Response:~p~n",[Ans]),
 %    io:format("--> process_post DB Response:~p~nbefore~n~p~n",[Ans,RD]),
     RD2 = wrq:append_to_resp_body(Ans,RD1),
 %    RD1 = wrq:append_to_response_body(<<"body here">>,RD1),
 %    io:format("--> process_post RD~n~p~n",[RD2]),
     {true,RD2,Ctx}.
-  
+