From 3051963def484a223c04612b13a7c5e78398a257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81=C4=99picki?= Date: Mon, 7 Jan 2019 20:20:12 +0100 Subject: [PATCH] Use Elixir v1.5's streamlined child specs in docs (#3233) * Use Elixir v1.5's streamlined child specs in Endpoint docs * Use Elixir v1.5's streamlined child specs in mix ecto.gen.repo docs --- guides/endpoint.md | 2 +- guides/phoenix_mix_tasks.md | 11 ++++++----- lib/phoenix/endpoint.ex | 4 +++- 3 files changed, 10 insertions(+), 7 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/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 ] . . . ``` diff --git a/lib/phoenix/endpoint.ex b/lib/phoenix/endpoint.ex index be35cc79a0..073dc874e0 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