【发布时间】:2018-01-24 00:19:26
【问题描述】:
我有一个凤凰伞项目,其中有一些与我的main 应用程序相关的路线,然后是一些与我的child 应用程序相关的路线。
目前我绑定到两个端口(@987654323@ 和 child_web 配置的端口)然后我链接到我的 child 应用程序内的路由,引用我的子端口关联的 url。
我是否可以只绑定到一个端口,并在以下router.ex 文件的行中添加一些内容:
main_web/router.ex
scope "/" do
pipe_through :browser
get "/", MainWeb.PageController, :index
resources "/user", MainWeb.UserController
# Somehow delegating this to the ChildWeb app would be better
scope "/child", ChildWeb do
get "/", Page.Controller, :index
resources "/other", OtherController
end
end
child_web/router.ex
# if this is configured it would be everything after the /child url
scope "/", ChildWeb do
get "/page1", Page1Controller, :index
end
我不完全确定这将如何编写,但我觉得它的实现可能存在于某处,如果有人可以参考我上面的示例或 phoenix 文档,将不胜感激。
【问题讨论】:
标签: routing elixir phoenix-framework