Reputation: 25
Good day, I have been trying hard to generate a new controller in phoenix with elixir, but I'm getting this error:
The task "phoenix.gen.controller" could not be found
but I can manually create the file which I do not know the breakdown of doing it.
I'm using:
Elixir 1.2.6
Erlang OTP 18
Will appreciate any help
Upvotes: 2
Views: 2778
Reputation: 5812
First of all, did you add Phoenix into your mix.exs
? If so, there's no phoenix.gen.controller
task, but for generating controllers you have two options- using html
for generating controller with HTML view or json
for preparing API with JSON.
Go check this out.
I mentioned about two of these:
mix phoenix.gen.html # Generates controller, model and views for an HTML based resource
mix phoenix.gen.json # Generates a controller and model for a JSON based resource
Upvotes: 3