# `EctoDoctor.Plug`
[🔗](https://github.com/Daniel-Brai/ecto-doctor/blob/v0.0.1/lib/ecto_doctor/plug.ex#L2)

Lists the page's N+1 queries in a footer and in the browser console while you develop.

Add it to the browser pipeline in dev only since the footer shows SQL and file paths to anyone who loads the page.

    if Application.compile_env(:my_app, :dev_routes) do
      plug EctoDoctor.Plug
    end

It shows nothing until N+1 detection is attached, so attach it when the app starts in dev.

    # lib/my_app/application.ex in start/2
    if Application.get_env(:my_app, :dev_routes) == true and
         Code.ensure_loaded?(EctoDoctor.RepeatedQueries) do
      EctoDoctor.RepeatedQueries.attach(repo: MyApp.Repo)
    end

The footer lists every N+1 on the page, even ones the baseline file knows.

Pass `nonce: :csp_nonce` when a content security policy needs a nonce from that assign.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
