News for hackers. Stuff that matters.
Re:Ask HN: So, what's up with Phoenix (web framework)? by hartator on Saturday August 20, 2022 @10:29AM (#32532293)
The last time I try to play with it, I got stuck on 2 things that seem basic:

- Couldn’t serve a static folder! Like I had a folder of js/img that I wanted to serve as is, didn’t want to transform into anything, it was super difficult to do.

- Couldn’t find an easy way to inspect or debug a live pipe.

It was a while ago so maybe things have improved a lot. However it kind of left a sour taste in my mouth when asking for help, I was told static folder is not really the scope of the framework and things in the like.

Re:Ask HN: So, what's up with Phoenix (web framework)? by unvs on Saturday August 20, 2022 @11:15AM (#32532624)
In your generated `my_app_web/endpoint.ex` there is a plug that will serve static contents from your `priv/static` directory:

https://github.com/phoenixframework/phoenix/blob/master/inst...

This points to a function in `my_app_web.ex` which specifies which paths it will serve:

https://github.com/phoenixframework/phoenix/blob/master/inst...

So you can either copy your js and image folders to `priv/static/assets` and they will be available as `localhost:port/assets/js/somefile.js` etc. OR you can add `js` to the list of paths to serve in app_name_web.ex and copy your js files to `priv/static/js` and access them at `localhost:port/js/somefile.js`.