-
Notifications
You must be signed in to change notification settings - Fork 518
Support the contradictive "more than one page for the SPA" #348
Comments
I have slightly the same issue. For a client I have a number of administrative sites, a public site and a private member site. All of them are accessable via the same URL. When using .NET core you could create 3 different ASP.NET Core applications for setup, admin and the normal site and a single back-end web API and let in run on Kestrel. Then you could setup a web server in front (reverse proxy) that routes the public URL to the different web applications. You could IIS or Node for that purpose. So /api routes to the Web API, /setup routes to the setup web application. |
I was thinking about that as a solution. It just feels excessive to have three totally separate applications for this, especially since they are all very related. My hopes were that it would be possible/trivial to set this up in one and the same application instead. I mean, setting up webpack to do three different sites seems possible. And, setting up routes in the backend to handle the other two separately should also be doable. I was just hoping that I weren't the first one to try something like that :). |
You can absolutely have as many separate SPA-type apps served by the same ASP.NET Core site as you want. Just put them in separate directories, give them separate Webpack configs, and build separate bundles from them. They can be completely independent. As far as the server-side routing is concerned, it will be easiest if you route separate directories to them (e.g., |
I need an application that behaves like this:
When the site is installed I want the first user that accesses it to be redirected to
/setup
. Then when the user is done with the setup, the site is open for the public, on the root folder/
.Now, I can do this today, either all in on application or as two separate applications. But, in the first example it would mean that the /setup components would be delivered to the end-users as a part of the normal app too, even though they would never ever be needed. Which is obviously a bit unfortunate performance wise (memory and initial load).
The other way around is also possible, but then having the first application modify the second be a bit more cumbersome. Not to mention that two sites would both need to be installed by the "owner".
So, to avoid this it would be better if the setup and main app were indeed two totally independent client applications. At the same time it would be very preferable that they shared the same backend code, as the very nature of /setup would be to setup the configs and to initialize the DB.
I could make them as one and then when setup is done have it "delete" itself. However, this seems excessive. Also, that means that webpack would need to rebundle the app, and for production that doesn't sound like a good idea.
Maybe instead something like this would be better:
/setup
and one for/
. The first loads the setup.js bundle and the latter the main.js bundle. (The global css and scripts could probably stay the same.)The above means that we could have multiple pages handled by the same backend.
I can for example envision three different SPAs in my app:
/setup
,/admin
and / (the normal user site).The text was updated successfully, but these errors were encountered: