A list of basic examples using systemic
- system: calculatorSystem
- component: add
- component: mulitply
Running the system: npm run a
Note: in the related index.js
we create then system and the use it after starting it.
- system: calculatorSystem
- subsystem: positiveOperations
- component: add
- component: mulitply
- subsystem: negativeOperations
- component: subtract
- component: divide
- subsystem: positiveOperations
Running the system: npm run b
Note: in the related index.js
we start the subsystems then create the system and then use it after starting it. Each one of the subsystem comes with an index.js
files that acts as a manifest for that given subsystem, it tells us which component is the subsystem relying on.
- system: calculatorSystem
- subsystem: positiveOperations
- component: add
- component: mulitply
- subsystem: negativeOperations
- component: subtract
- component: divide
- subsystem: positiveOperations
Running the system: npm run c
Note: in the related index.js
we don't need to start the subsystems since we bootstrap them along with the system itself, all we have to do is starting the system after having it bootstrapped.
- system: calculatorSystem
- subsystem: positiveOperations
- component: add
- component: mulitply
- subsystem: negativeOperations
- component: subtract
- component: divide
- subsystem: positiveOperations
Running the system: npm run d
Note: it is extacly the same as the previuos example, we have only got ridden of the subsystems folders for a better folder structure, this is the recommended approach.
- system: exampleSystem
- subsystem: config
- component: config
- subsystem: logger
- component: logger
- subsystem: mongo
- component: mongo.primary
- component: mongo.secondary
- the above components are actually the same one instantiated two times with two different configurations.
- subsystem: config
Running the system: npm run e
Note: here is where things start to look more like a real case scenario. We have dependency injection between components. The config is scoped. The mongo subsystem comes with two different components in order to manage the connection to two different mongos. The primary and secondary mongo component come with the stop function.
- system: exampleSystem
- subsystem: config
- component: config
- subsystem: logger
- component: logger
- subsystem: mongo
- component: mongo.primary
- component: mongo.secondary
- the above components are actually the same one instantiated two times with two different configurations.
- subsystem: config
Running the system: npm run f
Note: it is extacly the same as the previuos example, we have just used the systemic-domain-runner to start the system.