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

Router / handlers #71

Open
hannahcmtucker opened this issue Apr 13, 2018 · 1 comment
Open

Router / handlers #71

hannahcmtucker opened this issue Apr 13, 2018 · 1 comment

Comments

@hannahcmtucker
Copy link

I noticed theres a bit code repetition in your routers / handlers.
This pops up a few times:

if (req.headers.cookie){
            let { jwt } = parse(req.headers.cookie)
            verify(jwt, process.env.JWT_SECRET, (err, decoded)=>{
// some code here
}

And also the JWT verifying logic is split between the router/handler files. It might be more consistent to keep it to one or the other.

Another thing you could consider is having some reusable functions for things like bcrypt / JWTs (perhaps in a separate utils file), which you can pull in when needed... :)

@vlbee
Copy link
Collaborator

vlbee commented Apr 13, 2018

what is a separate utils file? like logic but for utility code?

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