Update the RedirectionController.
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-08-21 10:46:04 +03:00
parent 59de90601a
commit 61af12a52a
4 changed files with 49 additions and 0 deletions
@@ -0,0 +1,10 @@
defmodule LinkShortenerWeb.RedirectionController do
use LinkShortenerWeb, :controller
alias LinkShortener.Links
def show(conn, %{"shorten" => shorten}) do
%{url: url} = Links.get_one_by_shorten!(shorten)
redirect(conn, external: url)
end
end
+1
View File
@@ -18,6 +18,7 @@ defmodule LinkShortenerWeb.Router do
pipe_through :browser
get "/", PageController, :home
get "/u/:shorten", RedirectionController, :show
end
scope "/api", LinkShortenerWeb do