endpoint.ex (1478B)
1 defmodule UsersWeb.Endpoint do 2 use Phoenix.Endpoint, otp_app: :users 3 4 # The session will be stored in the cookie and signed, 5 # this means its contents can be read but not tampered with. 6 # Set :encryption_salt if you would also like to encrypt it. 7 @session_options [ 8 store: :cookie, 9 key: "_users_key", 10 signing_salt: "zxmzAnTp", 11 same_site: "Lax" 12 ] 13 14 # socket "/live", Phoenix.LiveView.Socket, 15 # websocket: [connect_info: [session: @session_options]], 16 # longpoll: [connect_info: [session: @session_options]] 17 18 # Serve at "/" the static files from "priv/static" directory. 19 # 20 # When code reloading is disabled (e.g., in production), 21 # the `gzip` option is enabled to serve compressed 22 # static files generated by running `phx.digest`. 23 plug Plug.Static, 24 at: "/", 25 from: :users, 26 gzip: not code_reloading?, 27 only: UsersWeb.static_paths(), 28 raise_on_missing_only: code_reloading? 29 30 # Code reloading can be explicitly enabled under the 31 # :code_reloader configuration of your endpoint. 32 if code_reloading? do 33 plug Phoenix.CodeReloader 34 plug Phoenix.Ecto.CheckRepoStatus, otp_app: :users 35 end 36 37 plug Plug.RequestId 38 plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint] 39 40 plug Plug.Parsers, 41 parsers: [:urlencoded, :multipart, :json], 42 pass: ["*/*"], 43 json_decoder: Phoenix.json_library() 44 45 plug Plug.MethodOverride 46 plug Plug.Head 47 plug Plug.Session, @session_options 48 plug UsersWeb.Router 49 end