gpt4 book ai didi

routing - 有没有办法让 Phoenix 插头只用于一条路线?

转载 作者:行者123 更新时间:2023-12-04 00:05:44 26 4
gpt4 key购买 nike

在 Phoenix ,我的路线如下:

  scope "/", ManaWeb do
pipe_through [:browser, :auth]
get "/register", RegistrationController, :new
post "/register", RegistrationController, :register
end

但是我想为最后一条路线(POST)设置一个插头。

我将如何使用当前的工具来解决这个问题?

最佳答案

正如 Phoenix.Router.pipeline/2 的文档中所述

Every time pipe_through/1 is called, the new pipelines are appended to the ones previously given.



也就是说,这会起作用:

scope "/", ManaWeb do
pipe_through [:browser, :auth]
get "/register", RegistrationController, :new

pipe_through :post_plug
post "/register", RegistrationController, :register
end

关于routing - 有没有办法让 Phoenix 插头只用于一条路线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60996561/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com