如何在同一端口上运行两个 Angular 项目

发布于 2025-01-15 02:30:53 字数 91 浏览 1 评论 0原文

我正在开发一个项目,其中有多个角度项目。我想在同一端口(localhost:4000)上启动它们。这可能吗? Angular 可以在同一端口上启动两个项目的应用程序吗?

I am developping a project where I have more than one angular projects. I would like to launch them on the same port (localhost:4000). Is this possible? Can Angular launch an app of two projects on the same port?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

想挽留 2025-01-22 02:30:53

您只需将两个项目托管在各自的目录上(需要 IIS 配置)并使用 base-href 选项构建/部署您的应用程序:

ng build --prod --base-href=/admin // admin app
ng build --prod // public app

You only have to host both project on their respective directory (IIS configuration needed) and build/deploy your apps with the base-href option:

ng build --prod --base-href=/admin // admin app
ng build --prod // public app
忆沫 2025-01-22 02:30:53

可以将它们合并到一个项目中。

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects", 
  "projects": {
    "artists": {
         //This section contains the setting for the artists project      
    },
    "user": {
        //This section contains the setting for the user project
    }},
  "defaultProject": "artists"    
}
 

我相信您正在寻找这样的东西:
https://www.tektutorialshub.com/angular/angular -一个项目中的多个应用程序/

It would be possible to combine them under one project.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects", 
  "projects": {
    "artists": {
         //This section contains the setting for the artists project      
    },
    "user": {
        //This section contains the setting for the user project
    }},
  "defaultProject": "artists"    
}
 

I believe you are looking for something like this:
https://www.tektutorialshub.com/angular/angular-multiple-apps-in-one-project/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文