-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: main
Are you sure you want to change the base?
๐ค ๊น์ง #25
Conversation
chamjin
commented
Jan 8, 2024
•
edited
Loading
edited
- ๊ณ์ฐ๊ธฐ https://never4ott.tistory.com/37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ง์ด ์ด๋ ค์ ์ํ ๋ฐ ์ํธ์ ๊ฒ ๊ฐ์์. ๊ณ ์ํ์ จ์ต๋๋ค
๊น์ง/๊ณ์ฐ๊ธฐ/calculator.js
Outdated
function getArr(String) { | ||
const equation = String.replace(/\+/g, "~+~") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function getArr(String) { | |
const equation = String.replace(/\+/g, "~+~") | |
function getArr(string) { | |
const equation = string.replace(/\+/g, "~+~") |
|
||
const AddTask = require("./UserStorage"); | ||
|
||
class Task { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ์ผ ์ด๋ฆ์ User์ธ๋ฐ class๋ช
์ Task๋ค์.
์ง๊ธ์ ๋์ถฉ ๊ธฐํ๊ณผ ์ฝ๋๋ค์ด ๊ฐ๋จํด์ ํฐ ๋ฌธ์ ๋ ์์ง๋ง ๋์ค์ ์ด๋ฌ๋ฉด ์ฝ๋๋ฅผ ๋ณด๋ ์ฌ๋์ด ํด๋น ์ฝ๋๋ฅผ ๋ดค์ ๋ ์ด๋ค ์ญํ ์ ํ๋์ง๋ ์ดํดํ๊ธฐ ํ๋ค๊ณ ๋ฆฌ๋ทฐ์ ์ง๋ํ ๋จ์ด์ง ์๋ ์์ต๋๋ค.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start๋ผ๋ ๋ณ์๋ช ์๋ฟ์ง๊ฐ ์์์ ์ด๋ค ๊ฐ์ธ์ง ๋ชจ๋ฅด๊ฒ ์ด์