Routing 将路由器操作委派给其他应用程序中的控制器
我有一个凤凰伞项目,有许多路线与我的Routing 将路由器操作委派给其他应用程序中的控制器,routing,elixir,phoenix-framework,Routing,Elixir,Phoenix Framework,我有一个凤凰伞项目,有许多路线与我的mainapp相关,然后是一些路线与我的childapp相关 目前,我绑定到两个端口(配置为main\u-web和child\u-web的端口),然后链接到我的child应用程序中引用我的子端口关联的url的路由 我是否可以只绑定到一个端口,并在下面的router.ex文件中添加一些内容: main_web/router.ex scope "/" do pipe_through :browser get "/", MainWeb.PageContro
main
app相关,然后是一些路线与我的child
app相关
目前,我绑定到两个端口(配置为main\u-web
和child\u-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
# if this is configured it would be everything after the /child url
scope "/", ChildWeb do
get "/page1", Page1Controller, :index
end
child_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
# if this is configured it would be everything after the /child url
scope "/", ChildWeb do
get "/page1", Page1Controller, :index
end
我不完全确定这是如何编写的,但我觉得这可能存在于某个地方,如果有人能向我提供上述示例或phoenix文档,我将不胜感激。您可能希望使用: