hns / ringojs

Note: the main ringojs repository is now at http://github.com/ringo/ringojs
http://ringojs.org/
Apache License 2.0
41 stars 5 forks source link

Make Helma webapp stack fully JSGI compliant #7

Closed hns closed 14 years ago

hns commented 14 years ago

Currently, Helma middleware runs within the Helma webapp framework, not at the JSGI connector level. The primary reason was that at the time, I didn't like the way JSGI middleware was composed, e.g.:

f1(f2(f3(f4(f5))))

As it turns out, that's not really a good reason to create our own middleware spec, as the above can be written as:

[f1, f2, f3, f4, f5].reduceRight(function (a, b) {return b(a);})

which in turn could be made to look like this:

wrapMiddleware(f1, f2, f3, f4, f5) 

So basically there's no reason Helma can't use and provide true JSGI middleware while allowing apps to define middleware stacks as an array of functions, modules, or module names (using a naming convention for the function name):

exports.middleware = [
    'helma/middleware/gzip',
    'helma/middleware/etag',
    'helma/middleware/responselog',
    'helma/middleware/profiler'
];
hns commented 14 years ago

Preliminary design/implementation plan:

hns commented 14 years ago

Convert all middleware to pure JSGI and remove helma/webapp middleware support. Closed by edf70389188c35951c0238938857db6252997140.

hns commented 14 years ago

Fixed (needs some further cleanup)