什么相当于凤凰城的佣金路线?

时间:2016-02-12 23:40:13

标签: phoenix-framework

Ruby on Rails附带了终端命令dist。凤凰城有同等的东西吗?

2 个答案:

答案 0 :(得分:9)

命令为$ mix phoenix.routes

答案 1 :(得分:1)

由于@Martimatix指出$ mix phx.routes打印默认路由器的所有路由,这里是documentation

这是为此router.ex文件生成的路由示例:

defmodule MessageApi.Router do
  use MessageApi.Web, :router

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/api", MessageApi do
    pipe_through :api

    resources "/messages", MessageController, except: [:new, :edit]
    resources "/message_details", MessageDetailController, except: [:new, :edit]

  end
end

然后生成的路线将是:

       message_path  GET     /api/messages             MessageApi.MessageController :index
       message_path  GET     /api/messages/:id         MessageApi.MessageController :show
       message_path  POST    /api/messages             MessageApi.MessageController :create
       message_path  PATCH   /api/messages/:id         MessageApi.MessageController :update
                     PUT     /api/messages/:id         MessageApi.MessageController :update
       message_path  DELETE  /api/messages/:id         MessageApi.MessageController :delete
message_detail_path  GET     /api/message_details      MessageApi.MessageDetailController :index
message_detail_path  GET     /api/message_details/:id  MessageApi.MessageDetailController :show
message_detail_path  POST    /api/message_details      MessageApi.MessageDetailController :create
message_detail_path  PATCH   /api/message_details/:id  MessageApi.MessageDetailController :update
                     PUT     /api/message_details/:id  MessageApi.MessageDetailController :update
message_detail_path  DELETE  /api/message_details/:id  MessageApi.MessageDetailController :delete