phoenix-framework

forest 的头像作者 forest

Phoenix框架指南,用于路由配置和已弃用模块。在编写Phoenix路由文件、添加路由或配置作用域时使用。可防止由作用域别名和已弃用的Phoenix.View引起的重复模块前缀错误。

📖 中文导读:Phoenix框架指南,用于路由配置和已弃用模块。在编写Phoenix路由文件、添加路由或配置作用域时使用。可防止由作用域别名和已弃用的Phoenix.View引起的重复模块前缀错误。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: phoenix-framework description: Phoenix framework guidelines for router configuration and deprecated modules. Use when writing Phoenix router files, adding routes, or configuring scopes. Prevents duplicate module prefix bugs from scope aliasing and use of deprecated Phoenix.View.

Phoenix Framework Guidelines

Router Scope Aliasing

Router scope blocks include an optional alias that is automatically prefixed to all routes within the scope.

Never create your own alias for route definitions—the scope provides it:

scope "/admin", AppWeb.Admin do
  pipe_through :browser

  live "/users", UserLive, :index
end

The UserLive route points to AppWeb.Admin.UserLive automatically.

Always be mindful of this when creating routes to avoid duplicate module prefixes like AppWeb.Admin.Admin.UserLive.

Deprecated Modules

  • Never use Phoenix.View - it is no longer included with Phoenix