endpoint.ex 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. defmodule FourlettersWeb.Endpoint do
  2. use Phoenix.Endpoint, otp_app: :fourletters
  3. # The session will be stored in the cookie and signed,
  4. # this means its contents can be read but not tampered with.
  5. # Set :encryption_salt if you would also like to encrypt it.
  6. @session_options [
  7. store: :cookie,
  8. key: "_fourletters_key",
  9. signing_salt: "t4WDRoTt"
  10. ]
  11. socket "/socket", FourlettersWeb.UserSocket,
  12. websocket: true,
  13. longpoll: false
  14. socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
  15. # Serve at "/" the static files from "priv/static" directory.
  16. #
  17. # You should set gzip to true if you are running phx.digest
  18. # when deploying your static files in production.
  19. plug Plug.Static,
  20. at: "/",
  21. from: :fourletters,
  22. gzip: false,
  23. only: ~w(css fonts images js favicon.ico robots.txt)
  24. # Code reloading can be explicitly enabled under the
  25. # :code_reloader configuration of your endpoint.
  26. if code_reloading? do
  27. socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
  28. plug Phoenix.LiveReloader
  29. plug Phoenix.CodeReloader
  30. end
  31. plug Phoenix.LiveDashboard.RequestLogger,
  32. param_key: "request_logger",
  33. cookie_key: "request_logger"
  34. plug Plug.RequestId
  35. plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
  36. plug Plug.Parsers,
  37. parsers: [:urlencoded, :multipart, :json],
  38. pass: ["*/*"],
  39. json_decoder: Phoenix.json_library()
  40. plug Plug.MethodOverride
  41. plug Plug.Head
  42. plug Plug.Session, @session_options
  43. plug FourlettersWeb.Router
  44. end