API Modules - kremio/audio-remote GitHub Wiki

In order to pave the way to the possibility of extending the core functionalities with extra plugins without resorting to a contrived configuration mechanism, I've decided to implement an auto-loading mechanism.

Any JS script found under /api/ and its subfolders will be auto-loaded at runtime. WARNING: There is only one exception, which is that files named 'index.js' will be skipped.

A initial API message 'api.ready' will be issued once all the modules have been loaded. API modules that emit messages on initialisation, should register a listener for that message.

The idea is that the code in /api/ should mainly emit and respond to API messages and delegate the actual processing to other modules to be placed at the root level of the project.

Idea: move the API modules outside of /api/ and into there respective plugin folder and let the auto-loading take care of the rest.