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

[To Do List] Front-End Task #1

Open
woorim960 opened this issue Feb 27, 2021 · 0 comments
Open

[To Do List] Front-End Task #1

woorim960 opened this issue Feb 27, 2021 · 0 comments

Comments

@woorim960
Copy link
Owner

woorim960 commented Feb 27, 2021

๐Ÿ—’ To Do List ๊ตฌํ˜„

์‹œํ—˜ ์‹œ๊ฐ„: 3์‹œ๊ฐ„


๐Ÿ“Œ ๋ฌธ์ œ

SW ๊ฐœ๋ฐœ ๋™์•„๋ฆฌ ์†Œ์†์ธ ์šฐ์• ๋Š” ์ฃผ์–ด์ง„ API ๋ช…์„ธ๋ฅผ ๋ณด๊ณ  UI ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋Š” ์—…๋ฌด๋ฅผ ๋งก๊ณ  ์žˆ๋‹ค.
๊ตฌํ˜„ํ•ด์•ผํ•  ๊ธฐ๋Šฅ์€ 3๊ฐ€์ง€๋‹ค.

  1. ๋“ฑ๋ก
  2. ์ˆ˜์ •
  3. ์‚ญ์ œ

"HTML ๊ตฌ์กฐ"์™€ "API ๋ช…์„ธ"๋ฅผ ์ดํ•ดํ•˜๊ณ  todolist.js ๋ฅผ ์™„์„ฑํ•ด์•ผํ•œ๋‹ค.

  • HTML ํŒŒ์ผ ์œ„์น˜: app/src/views/todolist.ejs (ํ™•์žฅ์ž: ejs)
  • Javascript ํŒŒ์ผ ์œ„์น˜: app/src/public/js/todolist.js (ํ™•์žฅ์ž: js)

์•„๋ž˜์˜ Front-End ๊ตฌํ˜„ ๋ฐฉ๋ฒ•๊ณผ API ๋ช…์„ธ์„œ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์šฐ์• ์˜ Front-End ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ์„ ๋„์™€์ฃผ๋„๋ก ํ•˜์ž.


๐Ÿงพ ๊ณผ์ œ ๋‹ค์šด๋กœ๋“œ

์—ฌ๊ธฐ๋กœ ์ด๋™ํ•˜์—ฌ ZIP ์••์ถ• ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์•„์ฃผ์‹ญ์‹œ์˜ค.

์ฐธ๊ณ .jpeg
แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2021-02-28 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 3 29 14


๐Ÿ’ฃ ์ฃผ์˜ํ•  ์ 

  1. todolist.js ์™ธ ํŒŒ์ผ์ด ๋ณ€๊ฒฝ๋  ์‹œ ์ฑ„์ ์— ๋ถˆ์ด์ต์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • HTML(ํ™•์žฅ์ž: ejs) ํŒŒ์ผ๋„ ํฌํ•จ.



๐Ÿ’ก Front-End ๊ตฌํ˜„ ๋ฐฉ๋ฒ•

  1. ์ดˆ๊ธฐ UI์™€ HTML

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2021-02-27 แ„‹แ…ฉแ„’แ…ฎ 11 50 31

<body>
  <div>
    <h2>To Do List - Wooahan Agile</h2>
    <label for="name">Name</label>
    <input id="name" type="text">
    <label for="description">Description</label>
    <input id="description" type="text">
    <button>๋“ฑ๋ก</button>
  </div>

  <div id="table">
    <table>
      <tr>
        <th class="th-name">Name</th>
        <th class="th-description">Description</th>
        <th class="th-update">Update</th>
        <th class="th-delete">Delete</th>
      </tr>
    </table>
  </div>
</body>

  1. ๋“ฑ๋ก๋˜์—ˆ์„ ๋•Œ UI์™€ HTML

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2021-02-27 แ„‹แ…ฉแ„’แ…ฎ 11 52 45

Name๊ณผ Description์„ ์ž…๋ ฅํ•œ ํ›„ ๋“ฑ๋ก์„ ํด๋ฆญํ•˜๋ฉด ํ•˜๋‹จ ํ…Œ์ด๋ธ” ํƒœ๊ทธ<table>์— ์ถ”๊ฐ€๋˜๋„๋ก ๊ตฌํ˜„ํ•ด์•ผํ•œ๋‹ค.
์ด๋•Œ, ๊ฐ To Do์—๋Š” index ๋ฒˆํ˜ธ๊ฐ€ ์ง€์ •๋˜์–ด์•ผ ํ•œ๋‹ค๋Š” ์ ์„ ์œ ์˜ํ•˜์ž.
์•„๋ž˜ HTML ์ฐธ๊ณ .

<body>
  <div>
    <h2>To Do List - Wooahan Agile</h2>
    <label for="name">Name</label>
    <input id="name" type="text">
    <label for="description">Description</label>
    <input id="description" type="text">
    <button>๋“ฑ๋ก</button>
  </div>

  <div id="table">
    <table>
      <tr>
        <th class="th-name">Name</th>
        <th class="th-description">Description</th>
        <th class="th-update">Update</th>
        <th class="th-delete">Delete</th>
      </tr>
      <tr index="661f2f841dcfd6348d20">
        <td>๊ฐœ๋ฐœํ•˜๊ธฐ</td>
        <td>๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ ๊ตฌํ˜„ํ•˜๊ธฐ</td>
        <td><button id="td-update">์ˆ˜์ •</button></td>
        <td><button id="td-delete">์‚ญ์ œ</button></td>
      </tr>
    </table>
  </div>
</body>

  1. ์ˆ˜์ •๋˜์—ˆ์„ ๋•Œ UI์™€ HTML

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2021-02-28 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 12 01 22

Name๊ณผ Description์„ ์ž…๋ ฅํ•œ ํ›„ ์ˆ˜์ •์„ ํด๋ฆญํ•˜๋ฉด ์ž…๋ ฅํ•œ ๊ฐ’์œผ๋กœ ์ˆ˜์ •๋˜์–ด์•ผ ํ•œ๋‹ค.
์ฆ‰, ํ•˜๋‹จ ํ…Œ์ด๋ธ” ํƒœ๊ทธ<table> ์•ˆ์— ํด๋ฆญ๋œ tr ํƒœ๊ทธ<tr>์˜ HTML์ด ์ˆ˜์ •๋˜๋„๋ก ๊ตฌํ˜„ํ•ด์•ผํ•œ๋‹ค.
์ด๋•Œ, ์„œ๋ฒ„์—์„œ ์‘๋‹ตํ•ด ์ค€ index์™€ ๋™์ผํ•œ tr ํƒœ๊ทธ<tr>๊ฐ€ ์ˆ˜์ •๋˜์–ด์•ผํ•จ์„ ์œ ์˜ํ•˜์ž.
์•„๋ž˜ HTML ์ฐธ๊ณ .

<body>
  <div>
    <h2>To Do List - Wooahan Agile</h2>
    <label for="name">Name</label>
    <input id="name" type="text">
    <label for="description">Description</label>
    <input id="description" type="text">
    <button>๋“ฑ๋ก</button>
  </div>

  <div id="table">
    <table>
      <tr>
        <th class="th-name">Name</th>
        <th class="th-description">Description</th>
        <th class="th-update">Update</th>
        <th class="th-delete">Delete</th>
      </tr>
      <tr index="661f2f841dcfd6348d20">
        <td>์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค</td>
        <td>์šฐ์•„ํ•œ ์• ์ž์ผ</td>
        <td><button id="td-update">์ˆ˜์ •</button></td>
        <td><button id="td-delete">์‚ญ์ œ</button></td>
      </tr>
    </table>
  </div>
</body>

  1. ์‚ญ์ œ๋˜์—ˆ์„ ๋•Œ UI์™€ HTML

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2021-02-28 แ„‹แ…ฉแ„Œแ…ฅแ†ซ 12 35 23

์‚ญ์ œ๋ฅผ ํด๋ฆญํ•˜๋ฉด ํด๋ฆญ๋œ To Do๊ฐ€ ์‚ญ์ œ๋˜์–ด์•ผ ํ•œ๋‹ค.
์ฆ‰, ํ•˜๋‹จ ํ…Œ์ด๋ธ” ํƒœ๊ทธ<table> ์•ˆ์— ํด๋ฆญ๋œ tr ํƒœ๊ทธ<tr>๊ฐ€ ์‚ญ์ œ๋˜๋„๋ก ๊ตฌํ˜„ํ•ด์•ผํ•œ๋‹ค.
์ด๋•Œ, ์„œ๋ฒ„์—์„œ ์‘๋‹ตํ•ด ์ค€ index์™€ ๋™์ผํ•œ tr ํƒœ๊ทธ<tr>๊ฐ€ ์‚ญ์ œ๋˜์–ด์•ผํ•จ์„ ์œ ์˜ํ•˜์ž.
์•„๋ž˜ HTML ์ฐธ๊ณ .

<body>
  <div>
    <h2>To Do List - Wooahan Agile</h2>
    <label for="name">Name</label>
    <input id="name" type="text">
    <label for="description">Description</label>
    <input id="description" type="text">
    <button>๋“ฑ๋ก</button>
  </div>

  <div id="table">
    <table>
      <tr>
        <th class="th-name">Name</th>
        <th class="th-description">Description</th>
        <th class="th-update">Update</th>
        <th class="th-delete">Delete</th>
      </tr>
    </table>
  </div>
</body>

๊ฐœ๋ฐœ์ด ์™„๋ฃŒ๋˜์—ˆ๋‹ค๋ฉด ์กฐ์šฉํžˆ ์†์„ ๋“ค๊ณ  ๋ฉ˜ํ† ์˜ ๊ฒ€์ฆ์„ ๋ฐ›์€ ํ›„ PR(Pull Request)๋ฅผ ๋ณด๋ƒ…๋‹ˆ๋‹ค.




๐Ÿ’ก API ๋ช…์„ธ์„œ

  1. ๋“ฑ๋ก
  • Request

URL : /api/todolist
Method : POST
Content-type : application/json; charset=utf-8

{
   name: String,
   description: String
}
  • ์˜ˆ์‹œ
 { name: "๊ฐœ๋ฐœํ•˜๊ธฐ", description: "๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ ๊ตฌํ˜„ํ•˜๊ธฐ" }

  • Response

Status

์„ฑ๊ณต : 201 (Created)
์‹คํŒจ : 400 (Bad Request)

Content-type : text/html; charset=utf-8

  • ์„ฑ๊ณต
(String) ์ƒˆ๋กœ ๋“ฑ๋ก๋œ To Do์— ๋Œ€ํ•œ index ๊ฐ’
  • ์˜ˆ์‹œ
"661f2f841dcfd6348d20"

  • ์‹คํŒจ
(String) ์‹คํŒจ ๋ฉ”์„ธ์ง€
  • ์˜ˆ์‹œ
"To Do ๋“ฑ๋ก์— ์‹คํŒจํ•˜์…จ์Šต๋‹ˆ๋‹ค."


  1. ์ˆ˜์ •
  • Request

URL : /api/todolist/:index /api/todolist/661f2f841dcfd6348d20
Method : PUT
Content-type : application/json; charset=utf-8

{
   name: String,
   description: String
}
  • ์˜ˆ์‹œ
 { name: "๊ฐœ๋ฐœํ•˜๊ธฐ", description: "๋กœ๊ทธ์ธ ๊ธฐ๋Šฅ ๊ตฌํ˜„ํ•˜๊ธฐ" }

  • Response

Status

์„ฑ๊ณต : 201 (Created)
์‹คํŒจ : 400 (Bad Request)

Content-type : text/html; charset=utf-8

  • ์„ฑ๊ณต
(String) ์ˆ˜์ •๋œ To Do์— ๋Œ€ํ•œ index ๊ฐ’
  • ์˜ˆ์‹œ
"661f2f841dcfd6348d20"

  • ์‹คํŒจ
(String) ์‹คํŒจ ๋ฉ”์„ธ์ง€
  • ์˜ˆ์‹œ
"To Do ์ˆ˜์ •์— ์‹คํŒจํ•˜์…จ์Šต๋‹ˆ๋‹ค."


  1. ์‚ญ์ œ
  • Request

URL : /api/todolist/:index /api/todolist/661f2f841dcfd6348d20
Method : DELETE
Content : Null (Body๋ฅผ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.)



  • Response

Status

์„ฑ๊ณต : 200 (OK)
์‹คํŒจ : 400 (Bad Request)

Content-type : text/html; charset=utf-8

  • ์„ฑ๊ณต
(String) ์‚ญ์ œ๋œ To Do์— ๋Œ€ํ•œ index ๊ฐ’
  • ์˜ˆ์‹œ
"661f2f841dcfd6348d20"

  • ์‹คํŒจ
(String) ์‹คํŒจ ๋ฉ”์„ธ์ง€
  • ์˜ˆ์‹œ
"To Do ์‚ญ์ œ์— ์‹คํŒจํ•˜์…จ์Šต๋‹ˆ๋‹ค."
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

No branches or pull requests

1 participant