useid / handlersjs

MIT License
3 stars 3 forks source link

Handlers.js

Handlers.js provides a modular framework based on an abstraction of software components as handlers of data. Using the handlers in this repository, and custom handlers you build yourself, you can compose multiple specialized modules into a full application. Building software this way ensures easily maintainable, configurable and rewireable applications.

The real power of — and inspiration for — Handlers.js comes from the Components.js dependency injection framework, for which each package provides the necessary component configuration files. Combining Handlers.js with Components.js enables you to define each software component separately, and then wire them together declaratively using semantic configuration in JSON files, instead of hard-wiring them together in code.

Lots of the handlers in this repository are written for software design based on the Chain of Responsibility pattern, in which each processing component decides whether it is applicable based on the command input, and then passes the input to the next handler. Handlers.js combines this object-oriented pattern with asynchronous and functional programming approaches: handlers are basically functions which are composed into a single process, and return the caller a Promise that resolves when they are complete (or rejects when they encounter an error).

Packages

Usage

The packages in this repo are hosted on the GitHub npm registry. To use them, make sure your git configuration contains you GitHub username and e-mail address as values for the user.name and user.email parameters. You will also need a personal access token with at least the write:packages and read:packages scopes, and use it to log in to the registry.

$ git config --global user.name [your GitHub username]
$ git config --global user.email [your GitHub e-mail address]
$ npm login --registry=https://npm.pkg.github.com
Username: [your GitHub username]
Password: [your personal access token]
Email: [your GitHub e-mail address]

Contributing

Bugs and other issues are very welcome. To contribute PRs, clone the repository, and set up your git environment as specified above.

$ git clone git@github.com:useid/handlersjs.git