forked from ether/etherpad-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
Creating your first Etherpad plugin
johnyma22 edited this page Feb 26, 2012
·
16 revisions
Creating your own plugin in Etherpad Lite is really simple. You will need some basic Javascript understanding. This documentation is written for linux users but can be extremely simply transferred over to other operating systems.
cd {DIR_WHERE_ETHERPAD_LITE_IS_INSTALLED/plugins-available}
mkdir ep_my_example
cd ep_my_example
npm init
You can safely accept all the default settings suggested by npm init
Edit your plugin config file package.json
nano package.json
{
"name": "ep_my_example", // Your plugin name must begin with ep_
"description": "Adds an Apple response on /apples",
"version": "0.0.1",
"author": "RedHog (Egil Moeller) <egil.moller@freecode.no>",
"contributors": ["johnyma22 (John McLear) <john@mclear.co.uk>"],
"dependencies": {},
"engines": { "node": ">= 0.4.1 < 0.7.0" }
}
Edit your plugin config file ep.json
nano ep.json
{
"parts": [
{
"name": "apples",
"hooks": {
"expressCreateServer": "ep_my_example/apples:expressCreateServer"
}
}
]
}
Create your actual plugin Javascript code.
nano apples.js
exports.expressCreateServer = function (hook_name, args, cb) {
args.app.get('/apples', function(req, res) {
res.send("<em>Abra cadabra</em>");
});
}
Install your plugin:
npm install ep_my_example
Start your server and test:
cd ../..
bin/run.sh
lynx http://YOUR_SERVER_IP:YOUR_SERVER_PORT/apples
[Read some more about the plugin framework including how to manage parts.] (https://github.com/Pita/etherpad-lite/wiki/More-Etherpad-plugin-reading)