How to access the console of an Elixir application?

Asked

Viewed 127 times

1

I have a back-end application in Elixir that has a bug in the server, so that new users can not make a new registration in the app, but old users can use normally.

I need to enter a new user manually through the Elixir console so that this new user is recorded in the database and can use the app, but I have no idea how I can do this.

2 answers

1

You can spin iex -S mix at the root of the project to open a Elixir interactive shell (Iex) with the dependencies listed in Mix.

Inside the shell you can interact with your ORM. If it is Ecto, for example:

iex> {:ok, inserted} = MyApp.Repo.insert(%Post{title: "this is unique"})

If you are using Phoenix, also use the command iex -S mix phx.server, that in addition to the interactive shell, also starts the Phoenix server.

If you’re using Releases, go to the shell with bin/<release-name> remote, which is useful in production.

0

You can open your terminal/CMD depending on O.S, access the directory with the responsible module and use this command to access the console, exe: iex -S mix

Browser other questions tagged

You are not signed in. Login or sign up in order to post.