sunneach  committed 6ddc0ed


  • Participants
  • Parent commits f290176
  • Branches default

Comments (0)

Files changed (1)

 The resource code is already prepared to the tracing:
-	%% webmstn_notes_resource:init
+%% webmstn_notes_resource
 init([]) -> {ok, #ncontext{}}; %% trace off mode
 init([Cfg]) ->                 %% trace on  mode
     {trace_dir,Dir} = Cfg,
-	%% webmstn_static_resource:init
+%% webmstn_static_resource
 init([DocRoot]) -> {ok, #context{docroot=DocRoot}};
 init([Cfg,DocRoot]) -> 
     {trace_dir,Dir} = Cfg,
 	{{trace,AbsDir}, #context{docroot=DocRoot}}.
+==== CRUD Database operations. Server ====
-the JSON "notes" exchange will go through the "dynamic" channel. 
-Now it accepts all methods:
+The original version of StickyNotes has all operations communicating through the POST channel.
+The code was very short and elegant. The actual operation was parsed by the POST handler //process_post// and the //notes// was called for that action.
+The rest was encoding/decoding of the message body. Just several generic lines of code do all of it in the resource. 
+Not anymore. We have four different types of message (plus HEAD, which goes the same way as GET) and we need at least four handlers.
+Now //webmstn_notes_resource// accepts all methods:
+%% webmstn_notes_resource
 allowed_methods(RD, Ctx) ->
     {case wrq:path_info(note, RD) of
           undefined         -> ['POST'];        %% for the {["notes"], webmstn_notes_resource,[]}.