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 0000000..7f372bf Binary files /dev/null and b/priv/static/favicon.ico differ 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: /