London | 26-SDC-Mar | Ebrahim Beiati-Asl | Sprint 2 | Chat App frontend and backend#75
London | 26-SDC-Mar | Ebrahim Beiati-Asl | Sprint 2 | Chat App frontend and backend#75ebrahimbeiati wants to merge 22 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Code works on normal circumstances. My comments are mainly surrounding handling of
errors and unusual user input.
The README has this requirement:
It must also support at least one additional feature.
Can you describe the additional features you have implemented?
| timeStamp: new Date().toLocaleTimeString("en-US", { | ||
| hour: "numeric", | ||
| minute: "2-digit", | ||
| hour12: true, | ||
| }), | ||
| }; |
There was a problem hiding this comment.
Can you describe the pros and cons of creating the message timestamp
- on the user's machine
- on the server
?
In addition, how does this timestamp format affect users living in different time zones?
| app.post("/messages", (req, res) => { | ||
| const message = req.body; | ||
| messages.push(message); | ||
| res.status(201).json(message); |
There was a problem hiding this comment.
What's the reason to embed the received user message in the response?
Note: Normally we should also validate the message, but in this exercise let's assume the message format is always valid. That is, let's assume the received message is always sent by the code in script.js.
| await fetch(`${BACKEND_URL}/messages`, { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify(newMessage), | ||
| }); |
| const response = await fetch(`${BACKEND_URL}/messages`); | ||
| const messages = await response.json(); |
Learners, PR Template
Self checklist
Backend
https://xwc7hmpmk5kvt9ktptcvuuke.hosting.codeyourfuture.io
Frontend
https://uretqju43s9008b1nyjk586m.hosting.codeyourfuture.io