【发布时间】:2016-09-23 03:06:54
【问题描述】:
我正在尝试为 Elm 构建 JSON 后端。我只想提供一页 - elm.html、一个 js 文件 - Main.js - 和一个 css 文件。
我尝试了following these instructions,但那里不足以帮助像我这样的新手。
所以现在我有了 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
这个控制器
defmodule JwtExample.RootController do
use JwtExample.Web, :controller
plug :action
def index(conn, _params) do
redirect conn, to: "/elm.html"
end
end
还有我在web/static 和priv/static 中的文件
但是当我浏览到 /elm 时,我得到了
找不到 GET /elm.html (JwtExample.Router) 的路由
【问题讨论】:
标签: html json phoenix-framework elm