crisefd
Can't find init/1 function because controller is unavailable
I’m building my first app in Phoenix. And I keep seeing this warning all the time in my router.ex file:
warning: function DummyApiWeb.CommentController.init/1 is undefined (module DummyApiWeb.CommentController is not available)
lib/ldummy_api_web/router.ex:2
This is my router.ex :
defmodule DummyApiWeb.Router do
use DummyApiWeb, :router
pipeline :api do
plug :accepts, ["json"]
end
scope "/api/v1", DummyApiWeb do
pipe_through :api
resources "/users", UserController
resources "/clubs", ClubController do
resources "/items", ItemController do
resources "/comments", CommentController, only: [:create]
end
end
end
pipeline :browser do
plug :accepts, ["html"]
end
scope "/", DummyApiWeb do
pipe_through :browser
get "/", DefaultController, :index
end
end
And my comment_controller.ex:
defmodule DummyApi.CommentController do
use DummyApiWeb, :controller
def create(conn, %{"item_id" => item_id, "user_id" => user_id, "comment" => comment_params}) do
...
end
end
Marked As Solved
kokolegorille
Also Liked
crisefd
Popular in Questions
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Other popular topics
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









