From d2934efcaf8fbe90af8743aa5f4e1c3778782bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81=C4=99picki?= Date: Mon, 7 Jan 2019 13:21:08 +0100 Subject: [PATCH 1/2] Use Elixir v1.5's streamlined child specs in Endpoint docs --- guides/endpoint.md | 2 +- lib/phoenix/endpoint.ex | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/guides/endpoint.md b/guides/endpoint.md index b21de25999..c0dc01dfee 100644 --- a/guides/endpoint.md +++ b/guides/endpoint.md @@ -10,7 +10,7 @@ defmodule Hello.Application do #... children = [ - supervisor(HelloWeb.Endpoint, []), + HelloWeb.Endpoint ] opts = [strategy: :one_for_one, name: Hello.Supervisor] diff --git a/lib/phoenix/endpoint.ex b/lib/phoenix/endpoint.ex index 2418f2b941..af6b93e4e6 100644 --- a/lib/phoenix/endpoint.ex +++ b/lib/phoenix/endpoint.ex @@ -38,7 +38,9 @@ defmodule Phoenix.Endpoint do to the supervision tree in generated applications. Endpoints can be added to the supervision tree as follows: - supervisor(YourApp.Endpoint, []) + children = [ + YourApp.Endpoint + ] ### Endpoint configuration From 3fc6638f19421f02a5f485d74aeae61a24bf2691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81=C4=99picki?= Date: Mon, 7 Jan 2019 13:31:56 +0100 Subject: [PATCH 2/2] Use Elixir v1.5's streamlined child specs in mix ecto.gen.repo docs --- guides/phoenix_mix_tasks.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/guides/phoenix_mix_tasks.md b/guides/phoenix_mix_tasks.md index c0171776bc..e5fed5f894 100644 --- a/guides/phoenix_mix_tasks.md +++ b/guides/phoenix_mix_tasks.md @@ -713,13 +713,14 @@ We certainly should follow the instructions and add our new repo to our supervis ```elixir . . . children = [ - # Start the endpoint when the application starts - supervisor(HelloWeb.Endpoint, []), # Start the Ecto repository - worker(Hello.Repo, []), + Hello.Repo, + # Start the endpoint when the application starts + HelloWeb.Endpoint, + # Starts a worker by calling: Hello.Worker.start_link(arg) + # {Hello.Worker, arg}, # Here you could define other workers and supervisors as children - # worker(Hello.Worker, [arg1, arg2, arg3]), - worker(OurCustom.Repo, []), + OurCustom.Repo ] . . . ```