use controller to connect viewers with models and provide business logic:
const Controller = require('../controller');
const c = new Controller(new ModelXXX(),new ViewXXX());
c.method = ...
controller.api
is availible from View. So you can add methods to the c.api
and call them in View from this.api
./views/view-stdio.js
- console used for input and output../views/view-file.js
- file (specified in constructionnew ViewFile('path/to/filename')
) used for input and output.
./models/model-localstorage.js
- use pseudo-localstorage (require foldernew ModelLS('path/to/storage')
)./models/model-mongo.js
- use MongoDB (require server url, dbname and collectionnew ModelMongo('mongodb://url/dbname', collection)
)./models/model-redis.js
- use Redis