Ich versuche, ein JSON-Backend für Elm zu bauen. Ich möchte nur eine Seite bedienen - elm.html, eine js-Datei - Main.js - und eine CSS-Datei.Statische HTML-Seite in Phoenix
Ich versuchte following these instructions, aber es gibt nicht genug dort, um einem kompletten Neuling wie mir zu helfen.
So, jetzt habe ich router.ex
scope "/", JwtExample do
pipe_through :browser # Use the default browser stack
get "/elm", RootController, :index
get "/", PageController, :index
end
# Other scopes may use custom stacks.
scope "/api", JwtExample do
pipe_through :api
resources "/users", UserController, except: [:new, :edit]
end
Dieser Controller
defmodule JwtExample.RootController do
use JwtExample.Web, :controller
plug :action
def index(conn, _params) do
redirect conn, to: "/elm.html"
end
end
Und meine Dateien in web/static
und priv/static
Aber wenn ich zu/Ulme surfen ich
keine Route für GET /elm.html (JwtExample.Router)
Siehe: http://StackOverflow.com/Questions/35100117/How-to-serve-static-page-in-phoenix-framework – psantos