Reputation: 194
In the project I have phoenix web app which serves its own frontend (webpack 5, served on "/")
plug Plug.Static,
at: "/",
from: :myapp_web,
gzip: false,
only: ~w(css fonts images js robots.txt favicon.ico)
I want to add another frontend (which would be served on /app (this frontend uses API I built). I decided to try adding another frontend as static app, so I configured nuxt to build static files:
export default {
ssr: false,
target: 'static'
in nuxt.config.js
and configure endpoint properly:
plug Plug.Static,
at: "/app",
from: "myapp-app/dist",
gzip: false
this allows to work (but only partialy):
localhost:4000/app/index.html
and continue using app (since JS is loading partial views generated by nuxt (and changing url by window.href)localhost:4000/app/posts
in the address bar following file does not exist (which is expected, because html partial generated by nuxt is located under /posts/index.html
I want to found a way to fix that problem - by changing paths in Endpoint (when visiting localhost:4000/posts render file from localhost:4000/posts/index.html), however, I don't know how should I do that. I am thinking if this is the right approach and if not how should I proceed?
Upvotes: 0
Views: 123