Skip to content

London | 26-SDC-March | Zobeir Rigi | Sprint 3 | Middleware exercises#106

Open
Zobeir-Rigi wants to merge 3 commits into
CodeYourFuture:mainfrom
Zobeir-Rigi:middleware-exercises
Open

London | 26-SDC-March | Zobeir Rigi | Sprint 3 | Middleware exercises#106
Zobeir-Rigi wants to merge 3 commits into
CodeYourFuture:mainfrom
Zobeir-Rigi:middleware-exercises

Conversation

@Zobeir-Rigi

@Zobeir-Rigi Zobeir-Rigi commented Jul 2, 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

Exercise 1

  • Created a usernameMiddleware to read the X-Username header.
  • Added a middleware to parse and validate the POST request body.
  • Validated that the body is a JSON array containing only strings.
  • Returned different responses depending on whether the user is authenticated.

Exercise 2

  • Removed the custom JSON parsing middleware.
  • Replaced it with Express's built-in express.json() middleware.
  • Kept body validation in a separate middleware.
  • Updated the curl command to include Content-Type: application/json.

Result

The application now uses middleware to handle authentication and request validation, and uses Express's built-in JSON middleware instead of manually parsing request bodies.

@github-actions

This comment has been minimized.

@Zobeir-Rigi Zobeir-Rigi changed the title London | 26-SDC-March | Zobeir Rigi | Sprint 2 | jq Middleware exercises London | 26-SDC-March | Zobeir Rigi | Sprint 3 | Middleware exercises Jul 2, 2026
@github-actions

This comment has been minimized.

@Zobeir-Rigi Zobeir-Rigi added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Decomposition The name of the module. labels Jul 2, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The middleware looks good.

Note:
According to the spec, the apps are expected to be implemented in two separate sub-directories.

@cjyuan cjyuan 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. labels Jul 20, 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