News for hackers. Stuff that matters.
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`.

There are no comments on this comment yet.