Skip to content

Commit

Permalink
delete
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Feb 5, 2024
1 parent 348ed21 commit 1b8d600
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/up_rest.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ defmodule UP.HTTP do
get "/:type" do get3(conn,auth(conn),type,[],"lst") end
get "/:type/:id" do get3(conn,auth(conn),type,id,"get") end
put "/:type/:id" do put3(conn,auth(conn),type,id,"put") end
delete "/:type/:id" do delete3(conn,auth(conn),type,id,"del") end

def shd([]), do: []
def shd(x), do: hd(x)
Expand Down Expand Up @@ -146,8 +147,10 @@ defmodule UP.HTTP do

# DELETE PATHWAY

def delete3(conn,_,type,id,spec) do
:io.format 'DELETE:/#{type}#{id}/#{spec}', []
send_resp(conn, 200, encode(%{"type" => type, "spec" => spec})) end
def delete3(conn, _, type, _, _) do
send_resp(conn, 400,
encode([%{ "error" => "Method",
"text" => "Resource #{type} not found." }]))
end

end

0 comments on commit 1b8d600

Please sign in to comment.