'Route in Genie.jl 404's despite being defined in routes.jl

In Genie, I have the following code in routes.jl:

using Genie.Router

route("/") do
  serve_static_file("welcome.html")
end

I ran the server by typing up(). However, when I visit the index page, I get a 404 message:

julia> up()
┌ Info: 
└ Web Server starting at http://127.0.0.1:8000 
Genie.AppServer.ServersCollection(Task (runnable) @0x00000001765dbec0, nothing)

julia> ┌ Error: GET / 404
└ @ Genie.Router ~/.julia/packages/Genie/UxbVJ/src/Router.jl:163

I tried stopping the server and re-starting it but the issue persists. This happened to me at least 3-4 times now. I got it working in the past but it was not clear what actually worked.



Solution 1:[1]

I am not sure whether this helps anyone, but I had a similar error. I later noticed that I hadn't installed a package which was necessary for my app (didn't have it in my project.toml file) when I had ran "loadapp()", and there was errors in precompilation of some files.

Not noticing those errors at first, I ran up() nonetheless, and was surprised that routing didn't work.

Once I installed that package, and restarted the Julia session, routing worked

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1