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