siga

Sistema Interativo de GerĂȘncia de Atividades.
Log | Files | Refs | README | LICENSE

users_web.ex (1439B)


      1 defmodule UsersWeb do
      2   @moduledoc """
      3   The entrypoint for defining your web interface, such
      4   as controllers, components, channels, and so on.
      5 
      6   This can be used in your application as:
      7 
      8       use UsersWeb, :controller
      9       use UsersWeb, :html
     10 
     11   The definitions below will be executed for every controller,
     12   component, etc, so keep them short and clean, focused
     13   on imports, uses and aliases.
     14 
     15   Do NOT define functions inside the quoted expressions
     16   below. Instead, define additional modules and import
     17   those modules here.
     18   """
     19 
     20   def static_paths, do: ~w(assets fonts images favicon.ico robots.txt)
     21 
     22   def router do
     23     quote do
     24       use Phoenix.Router, helpers: false
     25 
     26       # Import common connection and controller functions to use in pipelines
     27       import Plug.Conn
     28       import Phoenix.Controller
     29     end
     30   end
     31 
     32   def channel do
     33     quote do
     34       use Phoenix.Channel
     35     end
     36   end
     37 
     38   def controller do
     39     quote do
     40       use Phoenix.Controller, formats: [:html, :json]
     41 
     42       import Plug.Conn
     43 
     44       unquote(verified_routes())
     45     end
     46   end
     47 
     48   def verified_routes do
     49     quote do
     50       use Phoenix.VerifiedRoutes,
     51         endpoint: UsersWeb.Endpoint,
     52         router: UsersWeb.Router,
     53         statics: UsersWeb.static_paths()
     54     end
     55   end
     56 
     57   @doc """
     58   When used, dispatch to the appropriate controller/live_view/etc.
     59   """
     60   defmacro __using__(which) when is_atom(which) do
     61     apply(__MODULE__, which, [])
     62   end
     63 end