hudson2010
Challenge with Serving Static files
Hello guys ,
I have set up some project , but I have som e bit of challenge with serving static files with the plug module
23:03:44.817 [debug] GET /home
23:03:44.817 [debug] Sent 200 in 32µs
23:03:44.849 [debug] GET /priv/js/test.js
*23:03:44.849 [debug] Sent 404 in 24µs*
==============================
Routes :
plug(Plug.Logger, log: :debug)
plug :match
plug :dispatch
plug Plug.Static, at: "/home", from: :server, only: ~w(js css images robots.txt)
get "/" do
send_resp(conn, 200, "Hello There!")
end
get "/about/:user_name" do
send_resp(conn, 200, "Hello, #{user_name}")
end
get "/home" do
conn = put_resp_content_type(conn, "text/html")
send_file(conn, 200, "priv/index.html")
end
I need some guidance on what , I be doing wrong , your assistance will be much appreciated
Most Liked
mhanberg
Expert LSP Core Team
plug :match
plug :dispatch
plug Plug.Static, at: "/", from: :server, only: ~w(js css images robots.txt)
must become
plug Plug.Static, at: "/", from: :server, only: ~w(js css images robots.txt)
plug :match
plug :dispatch
2
mhanberg
Expert LSP Core Team
mhanberg
Expert LSP Core Team
Last Post!
Popular in Discussions
Hi everyone,
I hesitated to post this here because I don’t want you to think I’m spamming, but I’ve been working on a Platform-as-a-Serv...
New
A couple of days ago I was discussing with a friend about different approaches to write microservices.
He said that if he was going to w...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
Background
A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell.
I...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Hi there Elixir friends :vulcan_salute:
In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
Other popular topics
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
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
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
Chat & Discussions>Discussions
Latest on Elixir Forum
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









