Scaffold denizen controller
This commit is contained in:
parent
3d154897a7
commit
cdbb6646eb
|
@ -46,6 +46,8 @@ defmodule HostasWeb do
|
|||
import HostasWeb.Gettext
|
||||
|
||||
unquote(verified_routes())
|
||||
|
||||
import HostasWeb.ControllerHelpers
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
defmodule HostasWeb.ControllerHelpers do
|
||||
import Plug.Conn
|
||||
|
||||
@doc """
|
||||
Mark an endpoint as unimplemented
|
||||
"""
|
||||
def unimplemented(conn) do
|
||||
conn
|
||||
|> send_resp(501, "")
|
||||
end
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
defmodule HostasWeb.DenizenController do
|
||||
# import Ecto.Query, only: [from: 2]
|
||||
use HostasWeb, :controller
|
||||
|
||||
# alias Hostas.Repo
|
||||
# alias Hostas.Denizen
|
||||
# alias Hostas.Token
|
||||
|
||||
def open(conn, _params) do
|
||||
unimplemented(conn)
|
||||
end
|
||||
|
||||
def close(conn, _params) do
|
||||
unimplemented(conn)
|
||||
end
|
||||
|
||||
def show(conn, _params) do
|
||||
unimplemented(conn)
|
||||
end
|
||||
|
||||
def update(conn, _params) do
|
||||
unimplemented(conn)
|
||||
end
|
||||
end
|
|
@ -35,6 +35,12 @@ defmodule HostasWeb.Router do
|
|||
get "/auth/token", Auth.TokenController, :verify
|
||||
delete "/auth/token/:id", Auth.TokenController, :revoke
|
||||
get "/auth/token/:id/renew", Auth.TokenController, :renew
|
||||
|
||||
post "/denizen", DenizenController, :open
|
||||
delete "/denizen/:id", DenizenController, :close
|
||||
get "/denizen/:id", DenizenController, :show
|
||||
patch "/denizen/:id", DenizenController, :update
|
||||
|
||||
end
|
||||
|
||||
# Enable LiveDashboard and Swoosh mailbox preview in development
|
||||
|
|
Loading…
Reference in New Issue