更新时间:2022-06-24 03:14:21
您必须在 server.js
中添加通配符 get
路由为:
You will have to add wildcard get
route in server.js
as:
app.use(express.static(__dirname + '/dist'));
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname + '/dist/index.html'));
});
解决方案 2
在dist文件夹中添加一个index.php
文件,在其中添加如下代码:
add one index.php
file in dist folder add following code in it:
<?php header( 'Location: /index.html' ) ; ?>
它将部署您的应用程序.
It will deploy your application.