Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿค— ๊น€์ง„ #25

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

chamjin
Copy link
Contributor

@chamjin chamjin commented Jan 8, 2024

Copy link
Collaborator

@hobiJeong hobiJeong left a comment

Choose a reason for hiding this comment

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

๋งŽ์ด ์–ด๋ ค์› ์„ํ…๋ฐ ์ž˜ํ‘ธ์‹  ๊ฒƒ ๊ฐ™์•„์š”. ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค

Comment on lines 24 to 25
function getArr(String) {
const equation = String.replace(/\+/g, "~+~")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
function getArr(String) {
const equation = String.replace(/\+/g, "~+~")
function getArr(string) {
const equation = string.replace(/\+/g, "~+~")

@chamjin chamjin requested a review from hobiJeong February 2, 2024 01:29

const AddTask = require("./UserStorage");

class Task {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ํŒŒ์ผ ์ด๋ฆ„์€ User์ธ๋ฐ class๋ช…์€ Task๋„ค์š”.
์ง€๊ธˆ์€ ๋Œ€์ถฉ ๊ธฐํš๊ณผ ์ฝ”๋“œ๋“ค์ด ๊ฐ„๋‹จํ•ด์„œ ํฐ ๋ฌธ์ œ๋Š” ์—†์ง€๋งŒ ๋‚˜์ค‘์— ์ด๋Ÿฌ๋ฉด ์ฝ”๋“œ๋ฅผ ๋ณด๋Š” ์‚ฌ๋žŒ์ด ํ•ด๋‹น ์ฝ”๋“œ๋ฅผ ๋ดค์„ ๋•Œ ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋Š”์ง€๋„ ์ดํ•ดํ•˜๊ธฐ ํž˜๋“ค๊ณ  ๋ฆฌ๋ทฐ์˜ ์งˆ๋˜ํ•œ ๋–จ์–ด์งˆ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

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

๋ฐฑ์—”๋“œ, ํ”„๋ก ํŠธ ๋‘˜ ๋‹ค ์•Œ์•„์•ผ ํ•˜๋Š” ๋‚ด์šฉ์ด๋ผ ์ฝ”๋ฉ˜ํŠธ๋ฅผ ๋‹ฌ์•„๋ด…๋‹ˆ๋‹ค.
๋ฆฌ์†Œ์Šค๋ฅผ ์ƒ์„ฑ, ์ˆ˜์ •, ํ˜น์€ ํŠน์ • ๊ฐ’์„ ์ฐพ๊ธฐ ์œ„ํ•ด ์„œ๋ฒ„์— ์š”์ฒญ๊ฐ’์„ ๋ณด๋‚ด๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด login-lecture ๊ฐ•์˜์—์„œ ๋ฐฐ์› ์„ ๊ฒ๋‹ˆ๋‹ค.
๊ฑฐ๊ธฐ์„œ ๋ฐฐ์šด๊ฒŒ body์ด๋‹ˆ ๋‹ค๋“ค body๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ตฌ์š”. ํ•˜์ง€๋งŒ ์‹ค์ œ๋กœ ๋ชจ๋“  ์š”์ฒญ์—์„œ body๋ฅผ ํ†ตํ•ด ํ†ต์‹ ํ•˜๋Š”๊ฑด REST API๋ฅผ ๊ณต๋ถ€ ํ•ด๋ณธ๋‹ค๋ฉด ์ž˜๋ชป๋œ ๋ฐฉ๋ฒ•์ด๋ผ๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
RESTfulํ•œ api๋ผ๋ฉด ์š”์ฒญํ•˜๋Š” HTTP ๋ฉ”์„œ๋“œ, URI๋งŒ ๋ณด๊ณ ๋„ ์–ด๋– ํ•œ ์š”์ฒญ์„ ํ•˜๋Š”๊ตฌ๋‚˜๋ฅผ ์•Œ ์ˆ˜ ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
ex) PATCH http://localhost:3000/todo-lists/1

  • ํ•ด๋‹น ์š”์ฒญ์„ ๋ณด๋ฉด todo-lists ๋ฆฌ์†Œ์Šค ์ค‘์—์„œ 1๋ฒˆ์— ํ•ด๋‹นํ•˜๋Š” ๊ฐ’์„ ์ˆ˜์ •ํ•˜๋Š” ์š”์ฒญ์ด๊ตฌ๋‚˜! ๋ผ๊ณ  ์•Œ ์ˆ˜ ์žˆ์Œ.
  • ์ˆ˜์ •ํ•˜๋Š” ๋‚ด์šฉ์€ body์— ์‹ค์–ด์„œ ๋ณด๋ƒ„.

https://restfulapi.net/
์–ด์ฐจํ”ผ ์ง€๊ธˆ ๋ด๋„ ๋ญ” ์†Œ๋ฆฐ์ง€ ๋ชจ๋ฅผ๊ฒ๋‹ˆ๋‹ค. ์ €๋„ ์•„์ง์€ ๋‹ค ์ดํ•ด๋Š” ๋ชปํ–ˆ์–ด์š”.

id: check.id.replace("check", ""),
};
fetch("/to-do-list-c", {
method: "POST",
Copy link
Collaborator

Choose a reason for hiding this comment

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

์ง€๊ธˆ ๋ณด๋ฉด ์กฐํšŒ ๋ง๊ณ ๋Š” ์ „๋ถ€๋‹ค POST ์š”์ฒญ์ž…๋‹ˆ๋‹ค. HTTP ๋ฉ”์„œ๋“œ์— ๋Œ€ํ•ด ๋ช‡๋ฒˆ ์„ค๋ช…์„ ๋“œ๋ ธ๋˜ ๊ฒƒ ๊ฐ™์€๋ฐ ์–ด๋ ค์šด ๋‚ด์šฉ์€ ์•„๋‹ˆ๋ผ ๊ณต๋ถ€ํ•ด๋ณด์‹œ๊ณ  HTTP ๋ฉ”์„œ๋“œ๋ฅผ ์ž˜์ด์šฉํ•˜๋Š”๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”. ์ง€๊ธˆ์ฒ˜๋Ÿผ ์š”์ฒญํ•˜๋Š” url์— ์ด ์š”์ฒญ์ด ์–ด๋–ค ํ–‰์œ„๋ฅผ ํ•˜๋Š”์ง€ ํ‘œํ˜„(๋™์‚ฌ)ํ•˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ HTTP ๋ฉ”์„œ๋“œ๋กœ๋งŒ ํ‘œํ˜„๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

},
toDoList: async (req, res) => {
const task = new Task();
const start = await task.loadTask();
Copy link
Collaborator

Choose a reason for hiding this comment

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

start๋ผ๋Š” ๋ณ€์ˆ˜๋ช… ์™€๋‹ฟ์ง€๊ฐ€ ์•Š์•„์„œ ์–ด๋–ค ๊ฐ’์ธ์ง€ ๋ชจ๋ฅด๊ฒ ์–ด์š”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants