Closed jameBoy closed 9 years ago
var $middlewares = require('mount-middlewares')(__dirname);
// core controller var $ = require('mount-controllers')(__dirname).users_controller;
这里的require('mount-controllers')(dirname)和 require('mount-middlewares')(dirname);是什么样的用法?
hi
require('mount-controllers')(__dirname)会加载当前目录下的app/controllers下的所有文件,
比如users_controller.js
那么它就是
var $ = require('mount-controllers')(__dirname).users_controller;
这样可以少些一些代码,另外对生成器会非常友好
var $middlewares = require('mount-middlewares')(__dirname);
// core controller var $ = require('mount-controllers')(__dirname).users_controller;
这里的require('mount-controllers')(dirname)和 require('mount-middlewares')(dirname);是什么样的用法?