Really though, everything shown can be easily replicated with a bit of Connect middleware, and it'd be cleaner. I don't see the point?
Really though, everything shown can be easily replicated with a bit of Connect middleware, and it'd be cleaner. I don't see the point?
For an example of using ejs with Strata, take a look at the source to the Strata website: https://github.com/mjijackson/stratajs.org
https://github.com/LockerProject/Locker/blob/master/Ops/webs...
And tends to end with around 40 lines of checking URLs and other various bits of information to know which middleware can be chained in, and in which order that doesn't cause them to conflict with one another.
If Strata can solve this mess, then it's definitely a step up in my opinion.
And it's much nicer to use than the http module: layerable middleware, streaming responses, routing...
What I don't get, is you have to fight with Rack to get anything close to async, yet here comes a web framework for an async environment modeled after Rack, go figure.
I assume (meaning I'm about to make an ass out of u & an ass out of me) the answer is to pass a stream in place of the "Hello world!" string, but that would cause hell with any middleware expecting a completed response.
Strata borrows many concepts from Rack, but not the synchronous part. Instead of expecting your app to return something, Strata gives you a callback that you can use to serve the response when you're ready.
I admit the manual could probably give a better example of streaming a response. For now, check out the static file serving middleware (https://github.com/mjijackson/strata/tree/master/lib/static....). You'll see that the response body is simply a readable stream to the file on disk.