Skip to content

London | 26-SDC-March | Onur Atas | Sprint 2 | Chat app#102

Open
onurat wants to merge 3 commits into
CodeYourFuture:mainfrom
onurat:main
Open

London | 26-SDC-March | Onur Atas | Sprint 2 | Chat app#102
onurat wants to merge 3 commits into
CodeYourFuture:mainfrom
onurat:main

Conversation

@onurat

@onurat onurat commented Jun 29, 2026

Copy link
Copy Markdown

Self checklist

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

Deployed Frontend

https://wqpq4rsx4fzl0n6g8r8f0vp8.hosting.codeyourfuture.io/

Deployed Backend

https://gziswcuniy8wailsojnj6aki.hosting.codeyourfuture.io/messages

Features
Users can send messages.
Users can view all previous messages.
Messages automatically appear using polling.
Frontend and backend validation for empty messages.
Success and error feedback.
Message timestamps.
Responsive user interface.

@onurat onurat added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 29, 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.

Could you revert the changes made in the middleware-* folders to keep this PR clean?

Comment on lines +23 to +25
const { username, message } = req.body;

if (!username.trim() || !message.trim()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's good practice to validate all request inputs.

Note: A more robust implementation

  • Should also handle the case where req.body is null, which would cause const { text, sender } = req.body; to throw.
  • Should not assume text and sender are strings (if they existed)

In this exercise, let's assume the request is always coming from the code in script.js. So no change needed.

Comment on lines +38 to +39
username: usernameInput.value,
message: messageInput.value,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why not also validate the user input on the client side to reduce server's workload?

const status = document.getElementById("status");

async function loadMessages() {
const response = await fetch(`${server}/messages`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How should the app reacts to a failed fetch operation?


const time = new Date(message.timestamp).toLocaleTimeString();

p.innerHTML = `<strong>${message.username}</strong> <small>${time}</small><br>${message.message}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could username or message contain any special character that may mess up the display?

@cjyuan cjyuan 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 Jun 30, 2026
@github-actions

Copy link
Copy Markdown

The changed files in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the changed files tab at the top of the page, we are only expecting changes in this directory: ^chat-app/

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

1 similar comment
@github-actions

Copy link
Copy Markdown

The changed files in this PR don't match what is expected for this task.

Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints.

Please review the changed files tab at the top of the page, we are only expecting changes in this directory: ^chat-app/

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants