How to view phoenix routes in iex?

Doug

How do i view the output of a route in iex?

I know i can do this with mix Phoenix.routes but would like to do this interactively.

Here is an example of what I would like to do:

iex -S Phoenix.server

mymodel_path

this gives me this error:

** (CompileError) iex:2: undefined function mymodel_path/0
Dogbert

All the url/path helpers are compiled into functions in the module YourApp.Router.Helpers. You can import it and call with the same arguments as you would in your templates (you would probably pass conn as the first argument but since we don't have a conn in the iex session, you can pass YourApp.Endpoint instead):

iex(1)> import YourApp.Router.Helpers
nil
iex(2)> page_path(YourApp.Endpoint, :index)
"/"
iex(3)> task_path(YourApp.Endpoint, :show, 1)
"/tasks/1"

(I have a resources "/tasks", TaskController in this project.)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

IEx - How to cancel multiline command?

From Dev

Durandal router - how to define view as modal in routes definition

From Dev

How to restrict access to certain routes in Phoenix?

From Dev

How to use one view for multiple routes in Ember

From Dev

how to use named routes in view where named routes have wildcard

From Dev

Phoenix: Broadcasting from IEx console

From Dev

How to create a global view in Phoenix Framework?

From Dev

Phoenix; How to create a view with case

From Dev

How to define multiple values in routes from a view template in Play 2

From Dev

Phoenix: using "conn" and "case" in a view

From Dev

Phoenix: how to use values inserted in a template helper in a view function

From Dev

What's the equivalent of rake routes in Phoenix?

From Dev

Is there any way to define custom routes in Phoenix?

From Dev

Running iex mix phoenix.server on a different port does not work

From Dev

Shallow nested routes in Phoenix framework

From Dev

UndefinedFunctionError - iex aliasing in phoenix / ecto

From Dev

How to view phoenix routes in iex?

From Dev

How to colorize Elixir iex prompt?

From Dev

Phoenix IEx.pry not putting a break point in code

From Dev

Dynamic routes in Phoenix Framework

From Dev

Durandal router - how to define view as modal in routes definition

From Dev

How to call MVC routes from the View

From Dev

Phoenix: using "conn" and "case" in a view

From Dev

Shallow nested routes in Phoenix framework

From Dev

iex, how to reload structs effectively?

From Dev

String.split diferrent behaviour in iex and on phoenix webapi

From Dev

How to run iex as normal user?

From Dev

Phoenix: value is not retrieved in view

From Dev

Setting httpc proxy in iex (Phoenix project)

Related Related

  1. 1

    IEx - How to cancel multiline command?

  2. 2

    Durandal router - how to define view as modal in routes definition

  3. 3

    How to restrict access to certain routes in Phoenix?

  4. 4

    How to use one view for multiple routes in Ember

  5. 5

    how to use named routes in view where named routes have wildcard

  6. 6

    Phoenix: Broadcasting from IEx console

  7. 7

    How to create a global view in Phoenix Framework?

  8. 8

    Phoenix; How to create a view with case

  9. 9

    How to define multiple values in routes from a view template in Play 2

  10. 10

    Phoenix: using "conn" and "case" in a view

  11. 11

    Phoenix: how to use values inserted in a template helper in a view function

  12. 12

    What's the equivalent of rake routes in Phoenix?

  13. 13

    Is there any way to define custom routes in Phoenix?

  14. 14

    Running iex mix phoenix.server on a different port does not work

  15. 15

    Shallow nested routes in Phoenix framework

  16. 16

    UndefinedFunctionError - iex aliasing in phoenix / ecto

  17. 17

    How to view phoenix routes in iex?

  18. 18

    How to colorize Elixir iex prompt?

  19. 19

    Phoenix IEx.pry not putting a break point in code

  20. 20

    Dynamic routes in Phoenix Framework

  21. 21

    Durandal router - how to define view as modal in routes definition

  22. 22

    How to call MVC routes from the View

  23. 23

    Phoenix: using "conn" and "case" in a view

  24. 24

    Shallow nested routes in Phoenix framework

  25. 25

    iex, how to reload structs effectively?

  26. 26

    String.split diferrent behaviour in iex and on phoenix webapi

  27. 27

    How to run iex as normal user?

  28. 28

    Phoenix: value is not retrieved in view

  29. 29

    Setting httpc proxy in iex (Phoenix project)

HotTag

Archive