anchor.diff:  parse_session(_, Req, State) ->
                   {error, error_response(bad_request, ?input_not_json, Req, State)}.
   
  +exec_against_session(Req, State, Fun) ->
  +                case cowboy_req:binding(?session_id_param, Req) of
  +                  {undefined, Req1} ->
  +                    error_response(bad_request, ?session_id_required, Req1, State);
  +
  +                  {SessionId, Req1} ->
  +                    Fun(SessionId, Req1, State)
  +                end.
  +
   session_to_json(#erlchat_session { id = SessionId, user_id = UserId }) ->
                   jsx:encode([{status, ok}, {user_id, UserId}, {session_id, SessionId}]).
   
  
positive.code:                 {upgrade, protocol, cowboy_rest}.
  
  allowed_methods(Req, State) ->
                  {[<<"GET">>, <<"POST">>], Req, State}.
  
  content_types_accepted(Req, State) ->
                  {[{<<"application/json">>, init_session}], Req, State}.
  
  content_types_provided(Req, State) ->
                  {[{<<"application/json">>, get_session}], Req, State}.
  
  init_session(Req, State) ->
                  {ok, Body, Req1} = cowboy_req:body_qs(Req),
  
negative.code: 
  -include("erlchat.hrl").
  
  -define(session_id_param, session_id).
  
  -define(input_not_json, <<"Input wasn't in a valid application/json format.">>).
  -define(input_not_session, <<"Input wasn't a valid session object.">>).
  -define(session_id_required, <<"Session id required to fullfill the request.">>).
  
  %% rest handler callbacks
  -export([init/3, allowed_methods/2, content_types_accepted/2, content_types_provided/2, delete_resource/2]).
  
  %% custom callbacks
  -export([init_session/2, get_session/2]).
  