anchor.diff:      {true, Req, State}.
   
   known_methods(Req, State) -> 
  -    {[<<"GET">>,<<"POST">>,<<"DELETE">>], Req, State}.
  +    {[<<"OPTIONS">>,<<"GET">>,<<"POST">>,<<"DELETE">>], Req, State}.
   
   allowed_methods(Req, State) ->
  -    {[<<"GET">>,<<"POST">>,<<"DELETE">>], Req, State}.
  +    {[<<"OPTIONS">>,<<"GET">>,<<"POST">>,<<"DELETE">>], Req, State}.
   
   content_types_provided(Req, State) ->
       {[{<<"application/json">>, handle_json}], Req, State}.
  +
  +options(Req0, State) ->
  +    Req1 = cowboy_req:set_resp_header(<<"Access-Control-Allow-Headers">>,
  +                                                    <<"content-type">>, Req0),
  +    {ok, Req1, State}.
   
   resource_exists(Req0, #{identifier := Identifier} = State) ->
       case dbyr_identifier:get_metadata(Identifier) of
  
positive.code:             {ok, Req1} = cowboy_req:reply(500, [], stringify(Reason), Req0),
              {stop, Req1, State};
          ok ->
              {true, Req0, State}
      end.
  
  content_types_accepted(Req, State) ->
  
negative.code:     end,
      case dbyr_identifier:publish(Identifier, Metadata) of
          ok ->
              Req2 = set_cross_domain(Req1),
              Req3 = cowboy_req:set_resp_body(<<"true">>, Req2),
              {{true, dbyr_identifier:to_resource(Identifier)}, Req3, State};
          {error, Reason} ->
              ?ERROR("publish error: ~p~n", [Reason]),
              Req2 = set_cross_domain(Req1),
              {false, Req2, State}
      end.
  
  stringify(Reason) ->
      io_lib:format("~p", [Reason]).
  
  set_cross_domain(Req) ->
      cowboy_req:set_resp_header(<<"Access-Control-Allow-Origin">>, <<"*">>, Req).
  