Skip to content

London| 26 March SDC | Jamal Laqdiem| Sprint 3 | Middleware exercises#94

Open
jamallaqdiem wants to merge 3 commits into
CodeYourFuture:mainfrom
jamallaqdiem:feat-middleware-tasks
Open

London| 26 March SDC | Jamal Laqdiem| Sprint 3 | Middleware exercises#94
jamallaqdiem wants to merge 3 commits into
CodeYourFuture:mainfrom
jamallaqdiem:feat-middleware-tasks

Conversation

@jamallaqdiem

@jamallaqdiem jamallaqdiem commented Jun 6, 2026

Copy link
Copy Markdown
  • 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

Implement a custom middleware and a off the shelf middleware.

@github-actions

This comment has been minimized.

@jamallaqdiem jamallaqdiem added Module-Decomposition The name of the module. 📅 Sprint 3 Assigned during Sprint 3 of this module labels Jun 6, 2026
@github-actions

This comment has been minimized.

@jamallaqdiem jamallaqdiem added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 6, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 6, 2026
@jamallaqdiem jamallaqdiem changed the title Jamal Laqdiem| 26 March SDC | Jamal Laqdiem| Sprint 3 | Middleware exercises London| 26 March SDC | Jamal Laqdiem| Sprint 3 | Middleware exercises Jun 6, 2026
@jamallaqdiem jamallaqdiem added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 6, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful when using something like typescript. You have both js and ts versions here. Which is the one that you intended to commit / be reviewed?

Good start, but I have some questions

Comment thread custome-middlewares/dist/main.js Outdated
const count = subjects.length;
const subjectList = subjects.join(", ");
// 1. Format the authentication message using the custom header middleware
let authMessage = req.username

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this ternary expression required here for the auth message?

Comment thread off-the-shelf-middlewares/dist/main.js Outdated
const count = subjects.length;
const subjectList = subjects.join(", ");
// 1. Format the authentication message using the custom header middleware
let authMessage = req.username

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as before - what is the purpose of this ternary check?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the ternary check, as defined in my express.d.ts the req.username can be typed as string or null, this check ensure that the app fallback the friendly message.

@LonMcGregor LonMcGregor 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. labels Jul 1, 2026
@jamallaqdiem

Copy link
Copy Markdown
Author

Thanks for reviewing, you are right to mention that, as it's my first time dealing with typscript, I should add the compiled folder dist into the .gitignore and push only the .ts files.

@jamallaqdiem jamallaqdiem added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 3, 2026

@LonMcGregor LonMcGregor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good now. Much cleaner with just the typescript. If you're using a compiled or translated language remember to commit only the original source.

Task is complete now

@LonMcGregor LonMcGregor added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Module-Decomposition The name of the module. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants