我使用Angular 8构建一个应用程序,其根路由配置如下所示
const routes: Routes = [
{ path: '', redirectTo: '/index', pathMatch: 'full' },
{ path: 'index', loadChildren: () => import('./pages/index/index.module').then(mod => mod.IndexModule) },
];
在开发模式下,可以通过以下方式访问索引页。
现在,项目是通过命令 ng build --prod
,并在dist文件夹中产生一个编译文件的列表。
我把 dist 文件夹放在 node.js 项目的公共文件夹中。
--node.js app
-- public
-- express.js :3000 port
但我试图通过以下方式访问angular app
http://localhost:3000/dist/index.html#/index
浏览器告诉我
获取 http:/localhost:3000distindex.html。 500(内部服务器错误)
为什么会这样,如何解决?