Angarsk8 / Loopa-News

Realtime social news app developed from scratch with Elixir, Phoenix, Vue and Vuex

Home Page:https://loopa-news.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How does Phoenix serve Vue components?

christabella opened this issue · comments

I understand that when developing we have both the Phoenix server (for the api) and the Express development server running to serve the pages. So while developing router.ex doesn't need to even define a :browser pipeline.

For production, did you just have to deploy the Phoenix server that will serve the built static js and css files in priv/static? What about the Vue templates/the html?

Can I say that in production the Vue instance gets mounted to #app in web/templates/layout/app.html.eex, but in development the Vue instance gets mounted to #app in client/index.html?

Thank you!

I'm not @Angarsk8 but I'm pretty sure you're correct.

Hi @christabella,

Sorry for the late response, I've been quite busy. You are correct, in order to server the static files from the production server you have to build the client side project first, by running the command yarn build inside the client directory, that will build and bundle the project for production and will copy the generated files to the priv/static directory.

Thanks,

@Angarsk8 and @Oxyrus,

Thanks so much for your time and help! I will be closing the issue now.