anchor.diff:  %%%-------------------------------------------------------------------
   %%% @author evangelosp
  -%%% @copyright (C) 2014, <COMPANY>
  +%%% @copyright (C) 2014, evalonlabs
   %%% @doc
   %%%
   %%% @end
  
positive.code: -export([init/2]).
  -export([
    allowed_methods/2,
    allow_missing_post/2,
    charsets_provided/2,
    content_types_accepted/2,
    content_types_provided/2,
    delete_completed/2,
    delete_resource/2,
    expires/2,
    forbidden/2,
    generate_etag/2,
    is_authorized/2,
    is_conflict/2,
    known_methods/2,
    languages_provided/2,
    last_modified/2,
    malformed_request/2,
    moved_permanently/2,
    moved_temporarily/2,
    multiple_choices/2,
    options/2,
    previously_existed/2,
    resource_exists/2,
    service_available/2,
    uri_too_long/2,
    valid_content_headers/2,
    valid_entity_length/2,
    variances/2
  ]).
  -export([handle/2]).
  
  -record(state, {
    method, isAuthorized = true, etag,
    email, password, registred
  }).
  
  %% FLOW: ALL[0]
  init(Req, _Opts) ->
    {cowboy_rest, Req, #state}.
  
  %% FLOW: ALL[1] OR 503
  %% Return whether the service is available.
  
negative.code:       Email = binary_to_list(EmailBin),
        Password = binary_to_list(PasswordBin),
  
        case user_server:register(Email, Password) of
          {ok, Registred} ->
            NewState = State#state{registred = Registred},
            {true, cowboy_req:set_resp_body(jiffy:encode({Registred}), Req), NewState};
          _ -> {false, Req, State}
        end;
      false ->
        {stop, Req, State}
    end.
  