How to add new public directory in Phoenix framework
15/12/2015
Phoenix
In Phoenix web framework, there is a share directory /priv
. By default, it
will only public css,js,images,fonts
directory. However, If you want to share
a new directory to save upload image for example, you have to end_point file at
/lib/app_name/end_point.ex . Look at plug Plug.Static
, the only:
macro
declares which directory, files could be public. Simply, you have to append your
directory name at only:
line.
This is my configuration to add a directory named avatar public. This directory
is under /priv/static
.
Your tree should look like below