I would like to be able to build functionality for my application in a plugin style system for a couple reasons:
I'm not really sure how to go about implementing this. I would like to have a plugins
folder to host these separately but I guess my questions are:
I guess if anyone has a tutorial or some documentation relating to this technique that would be helpful. I've done a bit of searching but it's all a little too closely related to the actual code they're working with instead of the concept and I hadn't found anything specifically related to nodejs.
I suggest an approach similar to what I've done on the uptime project (https://github.com/fzaninotto/uptime/blob/master/app.js#L46):
Benefits:
Create a plugin prototype for the base functionality, and let the user define its plugin in a module. In the module the user would inherit an object from the prototype, extend its functionality, and then export a constructor which returns the plugin object.
The main system loads all plugins by require("pluginname") and for each calls the constructor.