New priv static folder Phoenix.Router.NoRouteError (Umbrella project)

Hi, I have a Umbrella project which has 2 phoenix projects and some normal elixir project under him self. in a phoenix project I needed, I added a file which name is uploads and add it on my Endpoint like this:

  plug Plug.Static,
    at: "/",
    from: :mishka_html,
    gzip: false,
    only: ~w(css fonts images js favicon.ico robots.txt uploads)

I can load everything on images folder but when I want to try to load the uploads folder I have this error:

Phoenix.Router.NoRouteError at GET /uploads/cb367cd1-7369-4532-a47b-23054a77447c.jpg

this folder exists on my project and the image I wanted was uploaded on uploads folder

my dev config:

config :mishka_html, MishkaHtmlWeb.Endpoint,
  live_reload: [
    patterns: [

My folder permissions

drwxr-xr-x   7 shahryar  staff   224 May 21 23:09 css
-rw-r--r--   1 shahryar  staff  1258 Jun 13 20:17 favicon.ico
drwxr-xr-x  11 shahryar  staff   352 May 21 23:09 fonts
drwxr-xr-x   9 shahryar  staff   288 May 24 07:19 images
drwxr-xr-x   7 shahryar  staff   224 May 21 23:09 js
-rw-r--r--   1 shahryar  staff   202 Jun 13 20:17 robots.txt
drwxr-xr-x   4 shahryar  staff   128 Jun 13 19:54 uploads

My file permissions

-rw-r--r--@  1 shahryar  staff  6602209 Jun 13 19:51 cb367cd1-7369-4532-a47b-23054a77447c.jpg

by the way I cleaned my Build folder, Please help me to fix this


It should be working… but having 2 phoenix projects in the same umbrella is strange.

Are You sure it’s the right one who answers the request?

I created a new phoenix project and move all file to it and it was fixed, I don’t know why it has this behavior, but it work now.

the first Phoenix on port 4000 is my LiveView and html render like blog and admin and etc, and my second Phoenix is my Api for everything on my project and I decided to separate them

You could have duplicated endpoint instead :slight_smile:

I didn’t understand, would you mind explaining me more than now please?
this a cms project and it can be separated on 2 ip and sub domain!! and server, every phoenix project has many files and router
this a cms project and it can be separated on 2 ip and sub domain!! and server, every phoenix project has many files and router. then I thought if these are different with each other, can be clear , and developer can handle it on 2 server and develop easyest when they have many version in the future. CMS, CRM , Ecommerce systems

When You build a Phoenix application, You have app and app_web.

Nothing stop You to add app_web2, with it’s own config, router, controllers etc.

It’s interesting only if it’s useful to share app, between both endpoints.

If You don’t need to share, it’s ok to have multiple Phoenix instances… but it seems You add a new Phoenix app for each new functionality.

1 Like

Oh, Thanks, yes your way can be useful in another my project, I didn’t know

yes, I just 2 different project, one of them is html render and the other is My api, I don’t think I need a another Phoenix project under umbrella any more, and these are enough for me, I think because this project has some normal elixir project, and these endpoints just call them for users.

do you have suggestion for me, if I wrong.

I have been mixing json api with “normal” web without problem, just by namespacing in the router (json controllers under controllers/api/)

It is useful when You have mixed clients.

As always, it depends which solution fits the best for your use case :slight_smile:

1 Like