Routing in SolidJS microfrontend
Hey,
I'm working on a big app "portal" that would contain several modules, separated in different apps.
At first I worked on one of the modules as a standalone app. It has its own routing and works when I run it as an app. I can go to /mymodule/mypage/mything?param1=param1¶m2=param2, using the app's navigation buttons or the browser.
I recently made the change to export it as a library, so in the portal app I can call <MyModule ...props /> when I try to access the page /mymodule (the portal app also has its own routing and allows the user to navigate through the different modules).
It actually works, and when I navigate through the module, it still works: I can go to "/mymodule/mypage/mything?param1=param1¶m2=param2" using the in-app navigation buttons.
But when I refresh the page or try to access this URL with the browser, I access to portal's "/mymodule/mypage/mything?param1=param1¶m2=param2", which doesn't lead to anything.
Does anyone have a fix for this? I don't want to export every route of my module. If possible, I'd prefer to keep using my module's routing. Is it possible to make the browser use the module's route instead of portal's route, while keeping the possibility to navigate through the different modules? (meaning I still want to access /mymodule, /mymodule2, /mymodule3 from portal).
Thank you, sorry I'm a bit confused so I'm not sure I explained well.
2 Replies
Wouldn't it work if in the portal router
/mymodule/*
routes to the module router?@bigmistqke thanks for your answer! I'm not sure, I think it already does... I'm sorry, I made a new post where I drew the issue because I couldn't explain well here, I didn't find how to add the pictures to the original post 😰 if you want to check it out you're more than welcome!