flatiron / union

A hybrid buffered / streaming middleware kernel backwards compatible with connect.

Home Page:http://github.com/flatiron/union

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where to put app.use() configurations?

PatrickHeneise opened this issue · comments

When using only flatiron, app.use() allows me to configure plugins like connect.session etc. ONCE when the app loads. With Union, flatiron.app is not used and doesn't work.

Putting connect.session, passport.js etc. into before [] means it's initialized to every single request, which means new sessions are generated etc.

How does that play together?
http://stackoverflow.com/questions/9777355/flatiron-js-union-where-to-put-app-use-configuration

I think your bug is the same as mine.
see issue #21 (actually I've seen your comment)

As far as I understand, problem is that session header is never sent to browser because the response.on('header') is never emit by union.

Well, yes, and no. Thanks to you comment I got the session support working. But passport.js still doesn't work.

I've just checked, and connect 2.0.2 changed its patch.js file and the way connect send cookie session.

I will test with this new version.

@PatrickHeneise Can you check this with master branch?

Thanks

@pksunkara Since there were too many other problems, I switched to express. I'll try it with the next project again and report back.

@amelon Can you check this issue now and give us some feedback?

Thanks

@PatrickHeneise @amelon The following works with master branch

var server = union.createServer({
  before: [
    connect.session({ secret: 'keyboard cat' }),
    passport.initialize(),
    passport.session(),
  ]
});

@pksunkara
actually, I didn't test passport.

my config for connect session is:

app.use(flatiron.plugins.http, {
  before: [
    connect.bodyParser()
    , connect.cookieParser('jab-boost')
    , connect.session({ secret: 'jab-boost', cookie: { maxAge: 60000 }})
    , ecstatic(__dirname + '/public')
  ]
});

and session is working.

Thanks, I tested passport and it's working too.