From 8f0d8278cf59a94af6ad61b5afa96c17ec3ed0c1 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 14 Jun 2026 07:43:37 +0200 Subject: [PATCH] provide message routes; allow serving of static files --- lib/web/server/endpoint.ex | 7 +++++++ lib/web/server/router.ex | 14 ++++++++++++++ mix.exs | 1 + priv/static/favicon.ico | Bin 0 -> 152 bytes priv/static/robots.txt | 5 +++++ 5 files changed, 27 insertions(+) create mode 100644 priv/static/favicon.ico create mode 100644 priv/static/robots.txt diff --git a/lib/web/server/endpoint.ex b/lib/web/server/endpoint.ex index a4b771a..137ff1a 100644 --- a/lib/web/server/endpoint.ex +++ b/lib/web/server/endpoint.ex @@ -1,6 +1,13 @@ defmodule Scopes.Web.Server.Endpoint do use Phoenix.Endpoint, otp_app: :scopes + plug Plug.Static, + at: "/", + from: :scopes, + gzip: not code_reloading?, + only: Scopes.Web.Server.static_paths(), + raise_on_missing_only: code_reloading? + plug Plug.RequestId plug Scopes.Web.Server.Router diff --git a/lib/web/server/router.ex b/lib/web/server/router.ex index 6df9082..3227522 100644 --- a/lib/web/server/router.ex +++ b/lib/web/server/router.ex @@ -9,17 +9,31 @@ defmodule Scopes.Web.Server.Router do pipe_through :api #resources "/", Controller, except: [:new, :edit] get "/", Controller, :index + get "/:domain/:action", Controller, :message + get "/:domain/:action/:class", Controller, :message + get "/:domain/:action/:class/:item", Controller, :message end end defmodule Scopes.Web.Server.Controller do use Scopes.Web.Server, :controller + alias Scopes.Util + + require Logger + require Util + def index(conn, _params) do render(conn, :index, message: "Hello Scopes!") #concepts = Storage.list_concepts() #render(conn, :index, concepts: concepts) end + + def message(conn, params) do + path_info = conn.path_info + Logger.info(Scopes.Util.show [path_info, params]) + render(conn, :index, message: "Hello Message") + end end defmodule Scopes.Web.Server.JSON do diff --git a/mix.exs b/mix.exs index 1555529..4ae5531 100644 --- a/mix.exs +++ b/mix.exs @@ -57,6 +57,7 @@ defmodule Scopes.MixProject do #test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"], test: ["test"], #precommit: ["compile --warnings-as-errors", "deps.unlock --unused", "format", "test"] + "phx.routes": "phx.routes Scopes.Web.Server.Router" ] end end diff --git a/priv/static/favicon.ico b/priv/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7f372bfc21cdd8cb47585339d5fa4d9dd424402f GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=@t!V@Ar*{oFEH`~d50E!_s``s q?{G*w(7?#d#v@^nKnY_HKaYb01EZMZjMqTJ89ZJ6T-G@yGywoKK_h|y literal 0 HcmV?d00001 diff --git a/priv/static/robots.txt b/priv/static/robots.txt new file mode 100644 index 0000000..26e06b5 --- /dev/null +++ b/priv/static/robots.txt @@ -0,0 +1,5 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: /