Skip to content

London |26-JUL - SDC | Ping Wang |Sprint 3| middleware exercises CYF -1165 - #117

Open
pathywang wants to merge 2 commits into
CodeYourFuture:mainfrom
pathywang:Sprint-3-middlewares
Open

London |26-JUL - SDC | Ping Wang |Sprint 3| middleware exercises CYF -1165#117
pathywang wants to merge 2 commits into
CodeYourFuture:mainfrom
pathywang:Sprint-3-middlewares

Conversation

@pathywang

@pathywang pathywang commented Sep 4, 2026

Copy link
Copy Markdown

Self checklist

  • 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

Task code

CYF -1165

Changelist

Did prep which took long time then made branch under parent directory and complete assignment with test

@github-actions

This comment has been minimized.

@pathywang pathywang changed the title SDC | London | Ping Wang |Sprint 3| middleware exercises CYF -1165 London |26-JUL - SDC | Ping Wang |Sprint 3| middleware exercises CYF -1165 Sep 4, 2026
@github-actions

This comment has been minimized.

@pathywang pathywang added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 4, 2026
Comment on lines +33 to +47
if (req.username) {
res.send(
`You are authenticated as ${req.username}.\n\n` +
`You have requested information about ${subjects.length} ` +
`${subjects.length === 1 ? "subject" : "subjects"}` +
`${subjects.length > 0 ? ": " + subjects.join(", ") : ""}.`
);
} else {
res.send(
`You are not authenticated.\n\n` +
`You have requested information about ${subjects.length} ` +
`${subjects.length === 1 ? "subject" : "subjects"}` +
`${subjects.length > 0 ? ": " + subjects.join(", ") : ""}.`
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not an error but I would like to suggest a better approach.

What is the output difference between if and else statements. Read those articles.

  1. Template literals
  2. Ternary operators

Hope you find a "clean code" way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants