Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Support the contradictive "more than one page for the SPA" #348

Closed
@Spiralis

Description

@Spiralis

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:

  1. Keep everything in one app
  2. Build two (+) different webpack bundles for the client. In my example "setup" and "main"
  3. Setup two (+) routes. One for /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.)
  4. The different client apps would set window.location manually when they need to navigate to different SPA apps, so that the server will send the application (at least I think that is the way to do it).

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).

  • Does anyone have any experience with something similar?
  • Have anyone had similar needs?
  • Does anyone know about any other way to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions