April 2020
Intermediate to advanced
292 pages
6h 50m
English
Let’s get started by laying out the bones of our Message Store code. Like all of our submodules, we’ll have a top level that receives dependencies and uses those dependencies to configure itself:
| | const createWrite = require('./write') |
| | function createMessageStore ({ db }) { |
| | const write = createWrite({ db }) |
| | return { |
| | write: write, |
We start the Message Store by requireing a file that doesn’t exist yet but that we will write immediately after the scaffolding here—the file that contains the logic for actually writing to the Message Store.
Next, we define createMessageStore, the top-level, dependency-receiving function that initializes the Message Store. ...
Read now
Unlock full access