Can someone please help me with this (Basic API creation) Rubber Ducky Edition

You put resources "/items", ItemController, except: [:new, :edit] inside a scope block as mentioned above.

In your case it should be like this:

  pipeline :api do
    plug :accepts, ["json"]
  end

 scope "/", AppWeb do
   pipe_through :api
   
   resources "/items", ItemController, except: [:new, :edit]
 end

To have an idea of what routes being generated of the resources then type mix phx.routes in your terminal.

1 Like