Skip to content

๐Ÿ“ Go๋ฅผ ์ด์šฉํ•œ Todo List ๊ฐœ๋ฐœ

Notifications You must be signed in to change notification settings

Dev-HyunSang/Todo-List

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Todo List

Go๋ฅผ ์ด์šฉํ•œ Todo List์„ ๊ฐœ๋ฐœ ํ”„๋กœ์ ํŠธ์ž…๋‹ˆ๋‹ค.
Go๋ฅผ ์ด์šฉํ•˜์—ฌ์„œ CRUD ๋ฐ ๊ธฐ๋ณธ์ ์ธ ๊ฐœ๋…์— ๋Œ€ํ•ด์„œ ๊ณต๋ถ€ ๊ฒธ ๊ฐœ๋ฐœ ํ”„๋กœ์ ํŠธ์ž…๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ๋ฅผ ์ข…๋ฃŒ ํ•˜์˜€์Šต๋‹ˆ๋‹ค. ํ˜„์žฌ ๋ฐฑ์—”๋“œ์—์„œ์˜ CRUD์— ํ•ด๋‹นํ•˜๋Š” ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค๋Š” ๊ฐœ๋ฐœ ์™„๋ฃŒ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
ํ”„๋ก ํŠธ์—”๋“œ ๊ฒฝ์šฐ์—๋Š” ์•„์ง ๊ฒฝํ—˜์ด ์ „๋ฌดํ•˜์—ฌ ์ถ”ํ›„์— ์—…๋ฐ์ดํŠธ ์‹œํ‚ฌ ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

โœจ TODO:

BackEnd

  • /todo: ์ƒˆ๋กœ์šด TODO ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€ํ•˜๊ธฐ / POST
    • /todo: index.html๋ฅผ ํ†ตํ•œ ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€ํ•˜๊ธฐ / POST
  • /todo: TODO ์ „์ฒด ๋ฆฌ์ŠคํŠธ ์ถœ๋ ฅํ•˜๊ธฐ / GET
  • /todo/{id:[0-9]+}: id ํ•ด๋‹นํ•œ TODO ๋ฆฌ์ŠคํŠธ ์ถœ๋ ฅํ•˜๊ธฐ / GET
  • /todo{id:[0-9]+}: TODO ๋ฆฌ์ŠคํŠธ ์ง€์šฐ๊ธฐ / DELETE
  • /todo: TODO ๋ฆฌ์ŠคํŠธ ์—…๋ฐ์ดํŠธ / PUT
    • /todo/{id:[0-9]+}: Boolํ˜•์„ ํ†ตํ•ด์„œ TODO ํ•ญ๋ชฉ ์ƒํƒœ ์—…๋ฐ์ดํŠธํ•˜๋„๋ก ์ œ์ž‘ / PUT
    • /todo/{id:[0-9]+}: TODOLIST Content ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ œ์ž‘ / PUT

FrontEnd

  • /todo: index.html๋ฅผ ํ†ตํ•œ ๋ฆฌ์ŠคํŠธ ์ถœ๋ ฅํ•˜๊ธฐ
  • index.html: ๊ฐ ํ•ญ๋ชฉ๋งˆ๋‹ค ๋”ฐ๋กœ๋”ฐ๋กœ ํ‘œ์‹œ
  • index.html: API JSON id๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌํ™”
  • index.html: TODO ํ•ญ๋ชฉ ํ”„๋ก ํŠธ์—”๋“œ์—์„œ ์‚ญ์ œ ๊ฐ€๋Šฅํ•˜๋„๋ก ์ œ์ž‘
  • index.html: ์ฒดํฌ ๋ฐ•์Šค๋ฅผ ์ด์šฉํ•˜์—ฌ์„œ Completed ํ•ญ๋ชฉ์— ๋Œ€ํ•œ ์ˆ˜์ • / ์™„๋ฃŒ๋˜์—ˆ๋Š”์ง€ ์•ˆ ์™„๋ฃŒ๋˜์—ˆ์ง€

๊ธฐ๋Šฅ

๋ฌด์—‡์ด ๋” ํšจ๊ณผ์ ์œผ๋กœ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๊ณ  ๊ฐ€๋…์„ฑ ์ข‹์€ API๋ฅผ ๋งŒ๋“ค์–ด์•ผ ํ•˜๋Š”์ง€์— ๋Œ€ํ•ด์„œ ๊ณ ๋ฏผํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

URL Methods ์„ค๋ช…
/ GET index.html์— ๋Œ€ํ•ด์„œ ํ™”๋ฉด์— ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
/todo GET ์ถ”๊ฐ€๋œ TODO ํ•ญ๋ชฉ ์ „์ฒด๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
/todo POST ์ƒˆ๋กœ์šด TODO ํ•ญ๋ชฉ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
/todo/{id:[0-9]+} GET TODO ํ•ญ๋ชฉ์˜ id๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ํ•ด๋‹น ID๋งŒ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
/todo/edit/{id:[0-9]+} GET ๊ธฐ์กด TODO ํ•ญ๋ชฉ์˜ id๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.(ํ˜„์žฌ ๋งˆ์Œ์— ์•ˆ ๋“œ๋Š” ๋ถ€๋ถ„์ด ์žˆ์–ด์„œ ์ˆ˜์ • ์ค‘...)
/todo/{id:[0-9]+} DELETE ๊ธฐ์กด TODO ํ•ญ๋ชฉ์˜ id๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ์„œ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

์ƒˆ๋กœ์šด TODO ๋ฆฌ์ŠคํŠธ ์ถ”๊ฐ€ํ•˜๊ธฐ

// Request | POST http://localhost:3000/todo 
{
    "content": "Hello" 
}
// Respone
{
    "id": 1,
    "Content": "Hello",
    "Completed": false,
    "created_at": "2021-07-11T15:47:40.890708+09:00"
}

TODO ๋ฆฌ์ŠคํŠธ ์ถœ๋ ฅํ•˜๊ธฐ / GET

// Reqeust / GET http://localhost:3000/todo/1

// Respone
{
    "id": 1,
    "Content": "์ด๊ฒƒ์€ ํ…Œ์ŠคํŠธ~",
    "Completed": false,
    "created_at": "2021-07-11T22:14:31.615345+09:00"
}

todo์— ์ถ”๊ฐ€๋œ ํ•ญ๋ชฉ๋“ค์„ ๋‹ค ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

// Reqeust / GET http://localhost:3000/todo

// Respone
[
    {
        "id": 1,
        "Content": "์ด๊ฒƒ์€ ํ…Œ์ŠคํŠธ~",
        "Completed": false,
        "created_at": "2021-07-12T18:57:16.710946+09:00"
    },
    {
        "id": 2,
        "Content": "์ด๊ฒƒ์€ ํ…Œ์ŠคํŠธ~",
        "Completed": false,
        "created_at": "2021-07-12T18:57:17.115232+09:00"
    },
    {
        "id": 3,
        "Content": "์ด๊ฒƒ์€ ํ…Œ์ŠคํŠธ~",
        "Completed": false,
        "created_at": "2021-07-12T18:57:17.899493+09:00"
    }
]

TODO ๋ฆฌ์ŠคํŠธ ์‚ญ์ œํ•˜๊ธฐ / DLETET

// Reqeust / DLETET http://localhost:3000/todo/1

// Respone
DLETET TODO LIST ID:1

์˜ค๋ฅ˜๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ๋ฐฉ๋ฒ•

๋งŽ์€ ๋ถ„๋“ค๊ป˜์„œ ๋„์™€ ์ฃผ์…จ์Šต๋‹ˆ๋‹ค

์˜ค๋ฅ˜ ํ•ด๊ฒฐ, ์ข‹์€ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ ์ฝ์€ ์ž๋ฃŒ๋“ค

About

๐Ÿ“ Go๋ฅผ ์ด์šฉํ•œ Todo List ๊ฐœ๋ฐœ

Topics

Resources

Stars

Watchers

Forks