如何从节点/Express服务器提供Vuejs前端文件? [英] How can I serve my Vuejs front end files from my node/express server?
问题描述
基本上,我有两条路线,其中一条在主页上表达,另一条在管理页面上表达,但是我找不到关于如何组合Vuejs和Express的很好的文档,因此我可以在两个页面同时使用的情况下进行服务UI有所不同,因此组件的构造也不相同.
Basically I have two routes with express one for the home page and other for the admin page, but I cannot find a good documentation on how to combine Vuejs and Express so I can serve at the same time both pages assuming that both have differents UI's so the components are not constructed the same.
推荐答案
要使用vue-router
并避免遇到404问题,您的express.js
必须具有提供index.html的后备功能.这是有关如何操作的vue
指南 https://router. vuejs.org/en/essentials/history-mode.html
To use vue-router
and avoid running into 404 issues, your express.js
has to have a fallback that serves the index.html. Here is a vue
guide on how to do it https://router.vuejs.org/en/essentials/history-mode.html
这篇关于如何从节点/Express服务器提供Vuejs前端文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!