Skip to content

Conversation

@Emilianouz
Copy link

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Middleware for user authentication and array validation, and configure .gitignore and package.json

@Emilianouz Emilianouz added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 3 Assigned during Sprint 3 of this module labels Jan 27, 2026
@OracPrime OracPrime added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Feb 10, 2026
Copy link

@OracPrime OracPrime left a 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;

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'}));

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'}));

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

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.

@OracPrime OracPrime added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants