Skip to content

NW | 26-SDC-Mar | TzeMing Ho | Sprint 2 | Chat App frontend and backend#78

Open
TzeMingHo wants to merge 9 commits into
CodeYourFuture:mainfrom
TzeMingHo:long-polling
Open

NW | 26-SDC-Mar | TzeMing Ho | Sprint 2 | Chat App frontend and backend#78
TzeMingHo wants to merge 9 commits into
CodeYourFuture:mainfrom
TzeMingHo:long-polling

Conversation

@TzeMingHo
Copy link
Copy Markdown

@TzeMingHo TzeMingHo commented May 14, 2026

Learners, PR Template

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

Changelist

frontend link:
https://tzemingho-chatapp-server-frontend.hosting.codeyourfuture.io

backend link:
https://tzemingho-chatapp-server-backend.hosting.codeyourfuture.io

A description of the additional features I have implemented.
Frontend:

  1. keepFetchingMessages, using long-polling
  2. messageFormHandler
  3. messageInputReset
  4. scrollToBottom
  5. createMessageThreads

Backend:

  1. get messages route
  2. post route

@github-actions

This comment has been minimized.

@TzeMingHo TzeMingHo changed the title added files NW | May 14, 2026
@github-actions

This comment has been minimized.

@TzeMingHo TzeMingHo changed the title NW | NW | 26-SDC-Mar | TzeMing Ho | Sprint 2 | Chat App frontend and backend May 14, 2026
@TzeMingHo TzeMingHo added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels May 14, 2026
@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 May 14, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@TzeMingHo TzeMingHo added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label May 14, 2026
Copy link
Copy Markdown

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

The code could use some comments.

A useful rule of thumb is to ask yourself whether you could still explain how the code works six months from now. If the answer is uncertain, consider adding a comment to help future readers understand the intent and reasoning behind it.


Can you also include this item in the PR description?

  • A description of the additional features you have implemented.

Comment thread chat-app/frontend/index.html
Comment thread chat-app/frontend/scripts.js Outdated
Comment thread chat-app/frontend/scripts.js Outdated
Comment thread chat-app/frontend/scripts.js
Comment thread chat-app/frontend/scripts.js
Comment thread chat-app/frontend/scripts.js Outdated
Comment thread chat-app/backend/app.js
Comment thread chat-app/backend/app.js
Comment thread chat-app/frontend/scripts.js
Comment thread chat-app/backend/app.js
@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 May 24, 2026
@TzeMingHo TzeMingHo added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels May 26, 2026
Copy link
Copy Markdown

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Changes look good. I just have two more comments.

Comment thread chat-app/frontend/scripts.js Outdated
const lastMessageTime = state.messages.at(-1)?.timestamp ?? null;
const queryString = lastMessageTime ? `?since=${lastMessageTime}` : "";
const url = `${state.backendURL}/messages${queryString}`;
const milliseconds = 100;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you think of a better name. milliseconds is too generic.

Comment thread chat-app/frontend/scripts.js Outdated
const url = `${state.backendURL}/messages${queryString}`;
const milliseconds = 100;
try {
// fetch may remain pending up to 25 seconds
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 also explain "why". That's probably the first question that comes to mind when someone sees that comment.

@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 May 26, 2026
@TzeMingHo TzeMingHo added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels May 28, 2026
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. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants