Plugin
Summary
Each plugin which wants to be loaded by core must inherit from this class.
This Class must not be used directly, instead create a sub class.
Constructor
Plugin
Syntax
Plugin
()
Summary
Example:
// Example for implementing a new Plugin named "MyPlugin"
// MyPlugin.js
var openVeoAPI = require('@openveo/api');
function MyPlugin(){
// Creates admin and front new routers
this.router = express.Router();
this.adminRouter = express.Router();
this.webServiceRouter = express.Router();
// Define routes directly here or in the configuration file
}
MyPlugin.prototype.start = function() {
console.log('My plugin loaded');
};
module.exports = MyPlugin;
util.inherits(MyPlugin, openVeoAPI.Plugin);
Methods
init
Syntax
init
-
callback
Summary
Offers the possibility to initialize the plugin.
A plugin may want, for example, to use this method to create indexes for its collections.
Parameters:
-
callbackFunctionFunction to call when it's done with :
- Error An error if something went wrong, null otherwise
start
Syntax
start
-
callback
Summary
Indicates that the plugin is fully loaded in application process and can be started.
Parameters:
-
callbackFunctionFunction to call when it's done with :
- Error An error if something went wrong, null otherwise
Properties
adminRouter
Syntax
adminRouter
Router
Summary
The plugin back end express router (all routes mounted on this router will require user authentication).
Default: null
router
Syntax
router
Router
Summary
The plugin public express router (all routes mounted on this router will be public).
Default: null
webServiceRouter
Syntax
webServiceRouter
Router
Summary
The plugin web service express router (all routes mounted on this router will require a web service authentication).
Default: null