mag icon indicating copy to clipboard operation
mag copied to clipboard

Simpler design

Open AlgoTrader opened this issue 10 years ago • 1 comments

The design of mag is modular, but it is certainly overkill for most of simple cases. I would suggest not the streams but "middleware" concept. This is the way express.js works, Faraday or Faye from Ruby world.

How I like logger to be:

var log = require('mag').logger(domain);
log.use( mag.colorFormatter )
log.use( function(item, cb)  {...} );

log.error('Oppa Ghannam Style');

The concept of middleware is it is some function that is called by module when it needs something. express.js is extremely simple - all I need is a single function for most of cases

AlgoTrader avatar Aug 13 '14 08:08 AlgoTrader

I think this feature is suitable for mag-hub module. Additional it is possible to implement both way: pipes and middlewares.

mahnunchik avatar Sep 07 '14 16:09 mahnunchik