我正在使用 express static 托管我的 angular 6 应用程序
app.use(express.static('/', __dirname +'/client/angular'));
当我尝试将另一个页面作为登录页面添加到我的服务器时,问题就出现了。所以我为我的角度应用程序指定了一个安装路径'/app'。
app.use(express.static('/app', __dirname +'/client/angular'));
这是行不通的!当我运行服务器时,这出来了
获取 /app/ 304 4.294 毫秒 - -
获取 /inline.bundle.js/ 404 1.065 毫秒 - 15
获取 /polyfills.bundle.js/ 404 0.581 毫秒 - 15
获取 /styles.bundle.js/ 404 2.195 毫秒 - 15
获取 /vendor.bundle.js/ 404 2.119 毫秒 - 15
获取 /main.bundle.js/ 404 1.830 毫秒 - 15
获取 /favicon.ico 404 0.474 毫秒 - 15
我解决了在虚拟路径“/home”中托管新网页的问题,并默认将我的 Angular 应用程序托管在根路径中。
app.use('/home', express.static(__dirname +'/client/landing'));
app.use('/', express.static(__dirname +'/client/angular'));
但这些不是我需要的路线,有人知道如何在快速虚拟路径上安装角度应用程序吗?