Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework's request and response on beforeSave #173

Open
cuongtavan opened this issue Jun 26, 2018 · 4 comments
Open

Framework's request and response on beforeSave #173

cuongtavan opened this issue Jun 26, 2018 · 4 comments

Comments

@cuongtavan
Copy link

cuongtavan commented Jun 26, 2018

@ethanresnick
While doing work with latest version 3.0.0-rc.6.0.1, I can't get data/property that I make change on Express middlewares before passing to the library
For example: with express session, req.session now is undefined
it works fine before (I tested with 3.0.0-beta.24)

beforeSave: function(resource, req, res, superFn) {
//can't get req.session here
}
@cuongtavan cuongtavan changed the title Framework request and response on beforeSave Framework's request and response on beforeSave Jun 26, 2018
@ethanresnick
Copy link
Owner

Ah, yeah. As documented here, the signature for beforeSave and beforeRender changed in 3.0.0-rc.3. That link explains the new signature. Basically, instead of req.session, you'll use extras.serverReq.session

@ethanresnick
Copy link
Owner

ethanresnick commented Jun 26, 2018

Note: more generally, there have been a few breaking changes in the RCs, so I'd definitely recommend reviewing the changelog before upgrading if you aren't already. I try to document breaking changes pretty thoroughly there.

@cuongtavan
Copy link
Author

Thank you so much!
I think lot of developers will firstly look at the example on README.md - which haven't been updated with latest change. That's a big cause to the issue and would be great if it's always be up to date

@ethanresnick
Copy link
Owner

I think lot of developers will firstly look at the example on README.md - which haven't been updated with latest change.

Ahh, thank you for pointing this out. I didn't realize it hadn't been updated. Will reopen this issue as a reminder to myself to update that. A PR would also be welcome, if you feel inspired.

@ethanresnick ethanresnick reopened this Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants