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

export lib methods #7

Closed
Industrial opened this issue Jun 4, 2014 · 9 comments
Closed

export lib methods #7

Industrial opened this issue Jun 4, 2014 · 9 comments

Comments

@Industrial
Copy link

Hi.

Upgrading a node project I noticed the function connect.utils.parseSignedCookies has moved to cookie-parser/lib/parse.js as signedCookies. I can't reach into it, because only the middleware is exported and the rest is private.

Would it be an idea to put the lib/parse.js functions on the exported function?

gr,

Tom

@dougwilson
Copy link
Contributor

Yea, I was thinking the same thing, that perhaps the stuff in parse should be exported.

/cc @defunctzombie @jonathanong

@joewagner joewagner reopened this Jun 4, 2014
@joewagner
Copy link
Member

Sorry about that! My cat stepped on the mouse and closed the issue!

@joewagner
Copy link
Member

I was going to comment that signedCookies is intended to be private. If its changed to be reachable, maybe prepend an _ to the name, so people understand that using it outside of this module is not recommended?

@dougwilson
Copy link
Contributor

@joewagner I think the thing is, we may want it to be public. So in essence, this library will create and set cookies in a certain way and people want to be able to read those cookies without actually straight-up using the middleware to read all cookies. Typically I see people using those functions for websockets, but I don't known enough about websockets to know if they are even doing the correct thing anyway (as far as I know, everyone could just be copy-pasting from everyone else).

@joewagner
Copy link
Member

@dougwilson That makes sense. I hadn't though about that type of use case for this lib.

@defunctzombie
Copy link
Contributor

I think having a function to parse signed cookies would be ok. Could even be a "method" of the middleware function returned when you create a cookie parser that way you don't need to keep passing in the secret.

@dougwilson
Copy link
Contributor

Could even be a "method" of the middleware function returned

I like that idea, actually :)

@dougwilson
Copy link
Contributor

Actually, this library is just to "parse cookies" as a middleware. The generation of the JSON/signed cookies should be a separate module, and this module should simply be a wrapper to use that other module to parse the cookies.

@Industrial
Copy link
Author

That sounds like a better idea.
On Jun 8, 2014 6:58 PM, "Douglas Christopher Wilson" <
notifications@github.com> wrote:

Actually, this library is just to "parse cookies" as a middleware. The
generation of the JSON/signed cookies should be a separate module, and this
module should simply be a wrapper to use that other module to parse the
cookies.


Reply to this email directly or view it on GitHub
#7 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants