# Basics
The main file in plugin (which is index.js
or it is specified in package.json
main
property)
is required to export either installer/initializer function or object with it.
// Both variants are correct
module.exports = core => {
// ...
};
module.exports = {
install (core) {
// ...
}
};
The argument of installer is plugin context, which is a special object that lets you registering plugin's functionality. Here is an example of registering database driver below:
class MyCoolDB {
// Full example will be available later
}
module.exports = core => {
core.db(MyCoolDB, 'mycooldb');
};
All available types that can be registered are described in this topic "API / Plugin context".
← Router