-
-
Notifications
You must be signed in to change notification settings - Fork 25
London | 25-SDC-Nov | Emiliano Uruena | Sprint 3 | Decomposition Middleware #63
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
base: main
Are you sure you want to change the base?
Conversation
…igure .gitignore and package.json
OracPrime
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor corrections required, otherwise excellent
| const usernameMiddleware = (req,res,next) => { | ||
| const usernameHeader = req.get('X-Username'); | ||
| // if exists, set if, otherwise set to null | ||
| req.username = usernameHeader || null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you intentionally using || rather than ?? here? If yes, and you understand the difference, that's fine.
|
|
||
| // middleware for body parsing and validation | ||
|
|
||
| app.use(express.text({ type: 'application/json'})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! adding that type parameter is necessary for this use case but easy to forget
|
|
||
| // middleware for body parsing and validation | ||
|
|
||
| app.use(express.text({ type: 'application/json'})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect you failed to delete this after the first half. Luckily because express.json comes before this in the list you get away with it, but I think this line needs removing.
| @@ -0,0 +1,2 @@ | |||
| /node_modules | |||
| package-lock.json No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you shouldn't ignore package-lock.json. Checking this file into version control is what allows another developer (or you, later) to replicate your build.
Changelist
Middleware for user authentication and array validation, and configure .gitignore and package.json