April 2020
Intermediate to advanced
292 pages
6h 50m
English
We use a technique called dependency injection[5] in this system. Quickly stated, you can sum up dependency injection as “passing functions the things they need to do their job.” This is in contrast to “having functions reach into the global namespace to get what they need to do their job.” Dependency injection doesn’t have anything to do with microservices, but it is how the code in this book is structured.
So, enter code/first-pass/src/config.js, and let’s set up its shell:
| | function createConfig ({ env }) { |
| | return { |
| | env, |
| | } |
| | } |
| | |
| | module.exports = createConfig |
That sure doesn’t do much yet. We’ll flesh it out once we’ve finished with the home page application.
Next, let’s write the file ...
Read now
Unlock full access