Is there any way in Phoenix to only generate a controller, without a model?

Is there any way in Phoenix to only generate a controller, without a model? In rails I will do it with

rails g controller Home index about
+4
source share
2 answers

As in version 1.2, there is no direct mixing task. Checked in the docs https://hexdocs.pm/phoenix/Phoenix.html

Although you could use a different method, as pointed out by @michalmuskala, use

mix phoenix.gen.html --no-model

+3
source

You can use the --no-modelfor option mix phoenix.gen.json/htmlto skip models and migrations, effectively getting only the controller.

+3
source

Source: https://habr.com/ru/post/1650396/


All Articles