Skip to content

Router / handlers #71

Description

@hannahcmtucker

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... :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions