Packages

Arke project generator. Provides a `mix arke.new` task to bootstrap a new Elixir application with Arke dependencies.

Current section

Files

Jump to
arke_new templates starter endpoint.ex
Raw

templates/starter/endpoint.ex

defmodule <%= @endpoint_module %> do
use Phoenix.Endpoint, otp_app: :<%= @arke_app_name %>
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.
@session_options [
store: :cookie,
key: "_<%= @arke_app_name %>_key",
signing_salt: "<%= @signing_salt %>",
same_site: "Lax"
]
<%= if @dashboard do %>
socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
plug Phoenix.LiveDashboard.RequestLogger,
param_key: "request_logger",
cookie_key: "request_logger"<% end %>
plug Plug.RequestId
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library()
# CORS configuration
unless Mix.env() == :dev do
plug(Corsica, origins: "*", allow_headers: :all)
else
plug(Corsica, origins: "*", allow_headers: :all)
end
plug Plug.MethodOverride
plug Plug.Head
plug Plug.Session, @session_options
plug <%= @arke_ns %>.Plug.Router
end