Phoenix Framework 是 Elixir 语言的一个 Web 应用开发框架。示例代码:
defmodule Controllers.Pages do use Phoenix.Controller def show(conn) do if conn.params["page"] in ["admin"] do redirect conn, Router.page_path(page: "unauthorized") else text conn, "Showing page #{conn.params["page"]}" end end end defmodule Controllers.Users do use Phoenix.Controller def show(conn) do text conn, "Showing user #{conn.params["id"]}" end def index(conn) do html conn, """
""" end end
发布于 2016-03-20 08:02:26 | 243 次阅读