首页 > 解决方案 > 在单个 Firebase 项目上托管多个 Angular 项目

问题描述

我正在考虑在一个 Firebase 项目下托管一个包含多个 Angular 项目的投资组合网站(例如https://aaaaa.firebaseapp.com/)。所以说我有 3 个角度应用程序(abc、def 和 ghi)。我将在单个投资组合登录页面上显示它们并在 firebase 上托管。 例如https://aaaaa.firebaseapp.com/abc https://aaaaa.firebaseapp.com/def https://aaaaa.firebaseapp.com/ghi 这怎么可能?请建议。

标签: angularfirebase-hostingportfolio

解决方案


Firebase 托管支持每个项目拥有多个站点。然后,您可以将每个站点配置为在路径下提供服务。

{
  "hosting": [ {
      "target": "blog",  // "blog" is the applied target name for the Hosting site "myapp-blog"
      "public": "blog/dist",  // contents of this folder are deployed to the site "myapp-blog"

      // ...
    },
    {
      "target": "app",  // "app" is the applied target name for the Hosting site "myapp-app"
      "public": "app/dist",  // contents of this folder are deployed to the site "myapp-app"

      // ...

      "rewrites": [...]  // You can define specific Hosting configurations for each site
    }
  ]
}

https://firebase.google.com/docs/hosting/multisites#define_hosting_config


推荐阅读