frontend / config / index.js
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
<video id="videoElm" autoplay muted controls loop>
<source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/webm">
</video>
</div>
<button class="shortvideo">play 2 secs only</a><br>
<button class="fullvideo">loop full video</button>
后端/app.js
build: {
index: path.resolve(__dirname, '../../backend/public/index.html'),
assetsRoot: path.resolve(__dirname, '../../backend/public'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
}
后端/路由/root.js
...
app.use(require('connect-history-api-fallback')());
...
app.use('/', root);
我通过npm run build在后端创建了一个公用文件夹。
我通过节点app.js运行快递服务器,但是我无法访问index.html或任何vue组件。
当与本地主机连接时:// 3000,我得到 const express = require('express');
const path = require('path');
const router = express.Router();
router.get('/', (req, res, next) =>{
res.sendFile(path.join(__dirname, '../public/index.html'))
});
module.exports = router;
而不是index.html。
我怎么了?