如何在angular2中的一个域中加载多个应用程序?

How to load multiple apps in one domain in angular2?

我正在尝试根据自己的角色在一个域中加载两个应用程序。 有两种实现方法:-

  1. 创建项目,通过asynchronous-routing方式创建app模块的children模块
  2. 创建一个项目并创建两个不同的应用程序,例如第一个是应用程序,第二个是应用程序 1,并根据角色加载。

我正在使用我项目的 angular-CLI。在我的项目中有 500 多个组件。那么哪个更好,如何实施呢?

运行 每个应用程序在其自己的站点上。

http://localhost:4000/
http://localhost:4001/

然后使用网关服务器根据url的一部分进行重定向:

http://localhost:80/admin ====> site1
http://localhost:80/public ====> site2