Is there a Phoenix equivalent to Rails Console

馋奶兔 提交于 2019-12-02 16:54:39

You can run iex -S mix to run iex with the dependencies in your current mix project included.. You can read about this at http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html

From there you can execute Ecto queries:

iex> MyApp.Repo.all(MyApp.User)

Running iex -S mix phoenix.server will also start the phoenix server.

For runtime debug, (like byebug or debugger or pry in rails), use

require IEx at the top of your model or controller or views file, then type

IEx.pry to wherever you need it to halt at runtime and continue debugging.

Type h for help inside the console

Most importantly, after all that, restart your server with:

iex -S mix phoenix.server

More info: here

If you're working in development, use iex -S mix phx.server.

If you need into the console of a deployed release, then go to your release directory and run bin/<name of your app> remote_console to open up a remote shell to your app's console.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!