daily-tracker

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

endpoint.ex (1736B)


      1 defmodule DailyTrackerWeb.Endpoint do
      2   use Phoenix.Endpoint, otp_app: :daily_tracker
      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: "_daily_tracker_key",
     10     signing_salt: "tg+Ej1Xb",
     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: :daily_tracker,
     26     gzip: not code_reloading?,
     27     only: DailyTrackerWeb.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     socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
     34     plug Phoenix.LiveReloader
     35     plug Phoenix.CodeReloader
     36     plug Phoenix.Ecto.CheckRepoStatus, otp_app: :daily_tracker
     37   end
     38 
     39   plug Phoenix.LiveDashboard.RequestLogger,
     40     param_key: "request_logger",
     41     cookie_key: "request_logger"
     42 
     43   plug Plug.RequestId
     44   plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
     45 
     46   plug Plug.Parsers,
     47     parsers: [:urlencoded, :multipart, :json],
     48     pass: ["*/*"],
     49     json_decoder: Phoenix.json_library()
     50 
     51   plug Plug.MethodOverride
     52   plug Plug.Head
     53   plug Plug.Session, @session_options
     54   plug DailyTrackerWeb.Router
     55 end