thojanssens1

thojanssens1

Function Phoenix.Endpoint.url/0 is undefined or private

Hello,

When I try to use:

IO.inspect Phoenix.Endpoint.url()

it says:

function Phoenix.Endpoint.url/0 is undefined or private

I tried to call another function from Phoenix like IO.inspect Phoenix.json_library() and it works (returns “Jason”).

Why does it say that the function url/0 is undefined or private?

Marked As Solved

aesmail

aesmail

Phoenix.Endpoint.url/0 is a callback.
Try YourAppWeb.Endpoint.url instead.

Also Liked

sb8244

sb8244

Author of Real-Time Phoenix

When you use Phoenix.Endpoint, the __using__ macro is invoked (phoenix/lib/phoenix/endpoint.ex at v1.4.10 · phoenixframework/phoenix · GitHub). This function unquotes several other blocks of code (phoenix/lib/phoenix/endpoint.ex at v1.4.10 · phoenixframework/phoenix · GitHub).

Here you can see where url/0 is implemented (phoenix/lib/phoenix/endpoint.ex at v1.4.10 · phoenixframework/phoenix · GitHub).

The callback dictates which functions must be defined when you implement a Behavior. url/0 is one of these functions. Phoenix, of course, provides default implementations for all of these core Behaviors.

Last Post!

sb8244

sb8244

Author of Real-Time Phoenix

When you use Phoenix.Endpoint, the __using__ macro is invoked (phoenix/lib/phoenix/endpoint.ex at v1.4.10 · phoenixframework/phoenix · GitHub). This function unquotes several other blocks of code (phoenix/lib/phoenix/endpoint.ex at v1.4.10 · phoenixframework/phoenix · GitHub).

Here you can see where url/0 is implemented (phoenix/lib/phoenix/endpoint.ex at v1.4.10 · phoenixframework/phoenix · GitHub).

The callback dictates which functions must be defined when you implement a Behavior. url/0 is one of these functions. Phoenix, of course, provides default implementations for all of these core Behaviors.

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49084 226
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement