Open panosru opened 12 years ago
ok, I got it wrong, req.session
is undefined with app.get
too, in the above example I didn't had /404
route set as I though I had app.use
with a method as a param that handle's not found routes... strange that req.session
is undefined... it used to work :S
it seems that if I setup resources before app.configure
they work but they don't have req.session
object (which is normal since the session is not yet initialized) if I setup resources after app.configure
then I'm getting error when I try to load a url:
Error: Can't render headers after they are sent to the client.
at ServerResponse.<anonymous> (http.js:562:11)
at ServerResponse._renderHeaders (/Volumes/Web/debian6/users/rnd/domains/design.rnd/public_html/app-ui/node_modules/express/node_modules/connect/lib/patch.js:76:25)
at ServerResponse.writeHead (http.js:848:20)
at ServerResponse._implicitHeader (http.js:805:8)
at ServerResponse.write (/Volumes/Web/debian6/users/rnd/domains/design.rnd/public_html/app-ui/node_modules/gzippo/lib/compress.js:80:34)
at ServerResponse.end (/Volumes/Web/debian6/users/rnd/domains/design.rnd/public_html/app-ui/node_modules/gzippo/lib/compress.js:87:23)
at /Volumes/Web/debian6/users/rnd/domains/design.rnd/public_html/app-ui/node_modules/i18next/lib/i18next.js:78:21
at [object Object].<anonymous> (fs.js:115:5)
at [object Object].emit (events.js:64:17)
at afterRead (fs.js:1111:12)
From what I understood so far from the debugging I did is that if you use app.enable('strict routing')
with express-resource you'll have some un-expected behavior thus I disabled it (although I would prefer to have it enabled).
Regarding the Can't render headers after they are sent to the client.
error message it was produced because of app.use(Gzippo.compress())
from gzippo module, I had to remove it for now and use the plain app.static()
method but I would like to send gziped content...
//cc @tomgallacher
I noticed that
req.session
is undefined for resources but it works fine for manually added routes usingapp.get
method/
is set throughapp.resource
and/404
is set throughapp.get