Skip to content

Instantly share code, notes, and snippets.

@cmstead
Last active April 5, 2018 19:37
Show Gist options
  • Save cmstead/a98472fdebd6e4fa5e691e1ebf7d7e9b to your computer and use it in GitHub Desktop.
Save cmstead/a98472fdebd6e4fa5e691e1ebf7d7e9b to your computer and use it in GitHub Desktop.
Dject main application example
'use strict';
// The only explicit filesystem or module reference in our whole application!!!
const container = require('./example-container');
const fileReader = container.build('fileReader');
// installed and system modules are loaded implicitly, no extra declaration needed
const path = container.build('path');
const contents = fileReader.readAFile(path.join(__dirname, 'staticFiles', 'myFile.txt'));
console.log(contents);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment