Skip to content
Browse files

initial

  • Loading branch information...
0 parents commit 676439e5fa73679d677f1498b5a9db28e7d8bd09 @isaacs committed May 30, 2012
Showing with 43 additions and 0 deletions.
  1. +43 −0 README.md
43 README.md
@@ -0,0 +1,43 @@
+# emcee
+
+A model loader that a controller calls. Basically, just the M and C
+bits of MVC.
+
+An interface for controllers to specify that certain models will be
+needed, and then have them get loaded.
+
+## Usage
+
+```javascript
+var MC = require('emcee')
+
+// add a bunch of models
+MC.model('login', function (req, cb) {
+ // callback is called with (er, data)
+ req.session.get('login', cb)
+})
+
+MC.model('train', function (url, res, cb) {
+
+})
+
+// later on...
+
+http.createServer(function (req, res) {
+ // check if the user is logged in.
+ var m = new MC()
+
+ m.load('login', req)
+ m.load('bike', req.url, res)
+
+ m.end(function (er, models) {
+ // either there is an error, or all models are loaded on the
+ // 'models' object. note that all errors are assumed to be
+ // catastrophic, so you only get the first error, and the
+ // models object will only contain the models that got loaded
+ // before the error occurred.
+ })
+}).listen(1337)
+```
+
+

0 comments on commit 676439e

Please sign in to comment.
Something went wrong with that request. Please try again.