-3

I've been assigned a project to demonstrate one codebase housing multiple web sites. Requests for any one of the housed domains would first come through the main project directory, which would pass control to the web site identified by the domain name.

The file structure would include subfolders for each web site (probably named by domain name) in the main project directory. Each of those web sites would be written in: ASP.NET/ASP.NET Core, Angular, or React; and each would contain its own routing mechanisms.

These are the main challenges that I'm looking to address:

  1. The main project directory would essentially exist to route requests to the appropriate web site in the appropriate subfolder. Is there a language/technology that I could use to accomplish this? (It would need to pass off routing control to the website, which could be written in any one of the earlier-mentioned technologies.)
  2. The domain name in the browser would need to remain the same, though the website is in a subfolder in the main project directory.

The codebase may begin with only three to ten web sites, but the idea is to create a codebase to house all of these projects and have scalability to add more sites later.

Is this possible?

sd-mustang
  • 17
  • 3
  • If the internal routing of sub-sites can be managed by things like a "switch" you can use WebComponents. If routes need to be managed into the search bar you will need to use IFrames. There are partial examples in my repo : https://github.com/gilsdav/angular-micro-frontend-sample/branches Take a look at this: https://www.npmjs.com/package/meta-spa-router – Gilsdav Dec 05 '18 at 21:59
  • I downloaded your angular-micro-frontend-sample code. In your example, it looks like the "routing" component maintains routing control for the web sites in the iframes. Is that correct? I'm also curious if the address bar could reflect simply the domain name for the home page of each site, or if it would need to look something like [http://localhost:4200/#one/home](http://localhost:4200/#one/home) to work properly. – sd-mustang Dec 07 '18 at 00:35
  • Unfortunately I think `meta-spa-router` use hashtag. Its mechanism is that parent listen child events and child listen parent events. I also test routes management between elements and root app but I looks that Angular Elements doesn't works well with Routing. I think you probably need a merge between "router", "iframe-router" branches and "meta-spa-router" implementation because there are some useful mechanism on each. – Gilsdav Dec 07 '18 at 21:04
  • I'm not sure that these options will provide the exact functionality of the project's original design, but I do appreciate these ideas for a different approach to the project. – sd-mustang Dec 08 '18 at 03:15

1 Answers1

0

Update: It was determined that the various web sites would be developed in their own codebases, since the benefit of one codebase does not outweigh the limitation of having a main "router" that maintains routing control for all web sites.

sd-mustang
  • 17
  • 3