feat(pastes): add raw paste handler
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
3 files changed
+9
-3
No files matched your search
@@ -25,6 +25,11 @@ defmodule KetbinWeb.PageController do
|
||||
render(conn, "show.html", paste: paste)
|
||||
end
|
||||
|
||||
def raw(conn, %{"id" => id}) do
|
||||
paste = Pastes.get_paste!(id)
|
||||
text(conn, paste.content)
|
||||
end
|
||||
|
||||
def create(conn, %{"paste" => paste_params}) do
|
||||
# generate phonetic key
|
||||
id = Utils.generate_key()
|
||||
|
||||
@@ -17,10 +17,11 @@ defmodule KetbinWeb.Router do
|
||||
end
|
||||
|
||||
scope "/", KetbinWeb do
|
||||
pipe_through :browser
|
||||
pipe_through [:browser, :fetch_current_user]
|
||||
|
||||
get "/", PageController, :index
|
||||
get "/:id", PageController, :show
|
||||
get "/:id/raw", PageController, :raw
|
||||
get "/v/:id", PageController, :showlink
|
||||
post "/", PageController, :create
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user