|
|
@@ -326,8 +326,15 @@ Crowi.prototype.buildServer = function() {
|
|
|
;
|
|
|
|
|
|
require('./express-init')(this, app);
|
|
|
- require('../routes')(this, app);
|
|
|
|
|
|
+ // import plugins
|
|
|
+ var isEnabledPlugins = true; // TODO retrieve from config
|
|
|
+ if (isEnabledPlugins) {
|
|
|
+ require('../plugins')(this, app);
|
|
|
+ }
|
|
|
+
|
|
|
+ require('../routes')(this, app);
|
|
|
+
|
|
|
if (env == 'development') {
|
|
|
//swig.setDefaults({ cache: false });
|
|
|
app.use(errorHandler({ dumpExceptions: true, showStack: true }));
|
|
|
@@ -346,6 +353,18 @@ Crowi.prototype.buildServer = function() {
|
|
|
return Promise.resolve(app);
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * require API for plugins
|
|
|
+ *
|
|
|
+ * @param {string} modulePath
|
|
|
+ * @return {module}
|
|
|
+ *
|
|
|
+ * @memberof Crowi
|
|
|
+ */
|
|
|
+Crowi.prototype.require = function(modulePath) {
|
|
|
+ return require(modulePath);
|
|
|
+}
|
|
|
+
|
|
|
Crowi.prototype.exitOnError = function(err) {
|
|
|
debug('Critical error occured.');
|
|
|
console.error(err);
|