provide message routes; allow serving of static files
This commit is contained in:
parent
6051502e61
commit
8f0d8278cf
5 changed files with 27 additions and 0 deletions
|
|
@ -1,6 +1,13 @@
|
||||||
defmodule Scopes.Web.Server.Endpoint do
|
defmodule Scopes.Web.Server.Endpoint do
|
||||||
use Phoenix.Endpoint, otp_app: :scopes
|
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 Plug.RequestId
|
||||||
|
|
||||||
plug Scopes.Web.Server.Router
|
plug Scopes.Web.Server.Router
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,31 @@ defmodule Scopes.Web.Server.Router do
|
||||||
pipe_through :api
|
pipe_through :api
|
||||||
#resources "/", Controller, except: [:new, :edit]
|
#resources "/", Controller, except: [:new, :edit]
|
||||||
get "/", Controller, :index
|
get "/", Controller, :index
|
||||||
|
get "/:domain/:action", Controller, :message
|
||||||
|
get "/:domain/:action/:class", Controller, :message
|
||||||
|
get "/:domain/:action/:class/:item", Controller, :message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defmodule Scopes.Web.Server.Controller do
|
defmodule Scopes.Web.Server.Controller do
|
||||||
use Scopes.Web.Server, :controller
|
use Scopes.Web.Server, :controller
|
||||||
|
|
||||||
|
alias Scopes.Util
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
require Util
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
render(conn, :index, message: "Hello Scopes!")
|
render(conn, :index, message: "Hello Scopes!")
|
||||||
#concepts = Storage.list_concepts()
|
#concepts = Storage.list_concepts()
|
||||||
#render(conn, :index, concepts: concepts)
|
#render(conn, :index, concepts: concepts)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
defmodule Scopes.Web.Server.JSON do
|
defmodule Scopes.Web.Server.JSON do
|
||||||
|
|
|
||||||
1
mix.exs
1
mix.exs
|
|
@ -57,6 +57,7 @@ defmodule Scopes.MixProject do
|
||||||
#test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
#test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"],
|
||||||
test: ["test"],
|
test: ["test"],
|
||||||
#precommit: ["compile --warnings-as-errors", "deps.unlock --unused", "format", "test"]
|
#precommit: ["compile --warnings-as-errors", "deps.unlock --unused", "format", "test"]
|
||||||
|
"phx.routes": "phx.routes Scopes.Web.Server.Router"
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
BIN
priv/static/favicon.ico
Normal file
BIN
priv/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 152 B |
5
priv/static/robots.txt
Normal file
5
priv/static/robots.txt
Normal file
|
|
@ -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: /
|
||||||
Loading…
Add table
Reference in a new issue