nuclear-module-registry
Version:
A nuclear module to register your nuclear modules.
47 lines (30 loc) • 926 B
Markdown
A nuclear module to register your nuclear modules.
To be able to resolve modules later in other parts of your app use
`nuclear-module-registry` registry to register them upfront.
```js
import { Reactor } from 'nuclear-js'
import { createRecord } from 'nuclear-record'
import { createRegistry } from 'nuclear-module-registry'
const registry = createRegistry(new Reactor)
const config = createRecord({
env: process.env.NODE_ENV
port: 3000
}, 'config')
registry.register(config)
// app/some-business-logic.js
import moduleRegistry from 'app/moduleRegistry'
const config = moduleRegistry.make('config')
console.log('Environment: %s, started at port: %s', config.getters.env(), config.getters.port())
```
```sh
> NODE_ENV=dev node app/some-business-logic.js
```
```
npm install nuclear-module-registry
```
MIT