PeterDavidCarter
I’ve run phx.gen.json to create an api to search and retrieve json formatted page content dynamically. After I run the command I see this message:
Add the resource to your :api scope in lib/haaksploits_web/router.ex:
resources "/pagecontent", PageContentController, except: [:new, :edit]
Remember to update your repository by running migrations:
$ mix ecto.migrate
However, after adding to the :api scope:
scope "/", HaaksploitsWeb do
pipe_through :browser
pipe_through :api
resources "/pagecontent", PageContentController, except: [:new, :edit]
I get the error:
== Compilation error in file lib/haaksploits_web/controllers/page_content_controller.ex ==
** (CompileError) lib/haaksploits_web/controllers/page_content_controller.ex:18: undefined function page_content_path/3
(stdlib) lists.erl:1338: :lists.foreach/2
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:121: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1
After running the ecto.migrate. I also tried like this:
scope :api do
resources "/pagecontent", PageContentController, except: [:new, :edit]
But that didn’t work either.
What’s the correct way to add the json resource to the api scope?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kokolegorille
I think it should be
You might also show page_content_controller.ex because the error is inside.
NobbZ
Probably routes.jelper not imported.
PeterDavidCarter
Hhhhhmmm. I changed to /api but it’s the same.
page_content.controller.ex:It was autogenned by the phx client, but I am seeing this error in my IDE next to the
HaaksploitsWeb, :controllerline:(CompileError) module HaaksploitsWeb.Router.Helpers is not loaded and could not be foundI’ve seen this error a few times when doing various things with my app and it often seems to go away when I reclone the repo, but not this time.
PeterDavidCarter
Yes, that does seem to be what’s happened, but why does this keep occurring and how do I stop it?
NobbZ
As far as I remember that module gets created when compiling the router as well. Please do a
mix cleanand amix buildand show full transcript of the latter.PeterDavidCarter
NobbZ
Please reinstall the mix archive of your project it causes module clashes.
Then try again.
PeterDavidCarter
Running
mix do archive.build, archive.installresults in the same error.NobbZ
I meant remove, sorry for the confusion.
benwilson512
I’d try doing an
rm -rf _build