57 lines
1.7 kB
1
defmodule BlogWeb.Endpoint do
2
use Phoenix.Endpoint, otp_app: :blog
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: "_blog_key",
10
signing_salt: "gC83CChD",
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
socket "/socket", BlogWeb.UserSocket,
19
websocket: true,
20
longpoll: false
21
22
# Serve at "/" the static files from "priv/static" directory.
23
#
24
# You should set gzip to true if you are running phx.digest
25
# when deploying your static files in production.
26
plug Plug.Static,
27
at: "/",
28
from: :blog,
29
gzip: false,
30
only: BlogWeb.static_paths()
31
32
# Code reloading can be explicitly enabled under the
33
# :code_reloader configuration of your endpoint.
34
if code_reloading? do
35
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
36
plug Phoenix.LiveReloader
37
plug Phoenix.CodeReloader
38
# plug Phoenix.Ecto.CheckRepoStatus, otp_app: :blog
39
end
40
41
plug Phoenix.LiveDashboard.RequestLogger,
42
param_key: "request_logger",
43
cookie_key: "request_logger"
44
45
plug Plug.RequestId
46
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
47
48
plug Plug.Parsers,
49
parsers: [:urlencoded, :multipart, :json],
50
pass: ["*/*"],
51
json_decoder: Phoenix.json_library()
52
53
plug Plug.MethodOverride
54
plug Plug.Head
55
plug Plug.Session, @session_options
56
plug BlogWeb.Router
57
end
58