Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Routing 将路由器操作委派给其他应用程序中的控制器_Routing_Elixir_Phoenix Framework - Fatal编程技术网

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文档,我将不胜感激。

您可能希望使用: