This is a simple example of an api that resolves federated module versions. The idea is to enable version change by configuration in runtime, rather than having to build and deploy the consumer of the module.
Note: express redirection is surely not the best way to do it. The purpose of this is just to demonstrate the concepts itself.
A new version of a federated module ("design-systrem") has been published at a cdn. A consumer of that module has tested this new version in TEST and UAT and is ready to start using it in PROD.
You want to change the version in use, without building or deploying.
-
install dependencies
npm i
-
start the server
node server
-
Visit the published consumer app: https://mf-consumer-jet.vercel.app/
-
Open the file data\modules.json and update the value of ["design-system"]["consumers"]["mf-consumer"]["prod"] from
"1.2.24"
to"1.2.25"
. Save. (No need to restart the server). -
Reload the consumer app and see that the default style of the button changed
mf-module, the "design-system" with the button component
mf-consumer, the application consuming the button component