{"id":1171,"date":"2023-03-28T21:54:37","date_gmt":"2023-03-28T12:54:37","guid":{"rendered":"https:\/\/www.gyuroot.com\/wordpress\/?p=1171"},"modified":"2023-07-04T22:12:57","modified_gmt":"2023-07-04T13:12:57","slug":"sprint-cozstory-was-%ea%b0%9c%eb%b0%9c","status":"publish","type":"post","link":"https:\/\/www.gyuroot.com\/wordpress\/?p=1171","title":{"rendered":"[Sprint] Cozstory WAS \uac1c\ubc1c"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_63 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >\ubaa9\ucc28<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gyuroot.com\/wordpress\/?p=1171\/#%E2%AC%9B_%EC%84%9C%EB%B2%84_%EC%BD%94%EB%93%9C_%EC%9E%91%EC%84%B1\" title=\"&#x2b1b; \uc11c\ubc84 \ucf54\ub4dc \uc791\uc131\">&#x2b1b; \uc11c\ubc84 \ucf54\ub4dc \uc791\uc131<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gyuroot.com\/wordpress\/?p=1171\/#%E2%AC%9B_%EA%B2%B0%EA%B3%BC_%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0\" title=\"&#x2b1b; \uacb0\uacfc \ud655\uc778\ud558\uae30\">&#x2b1b; \uacb0\uacfc \ud655\uc778\ud558\uae30<\/a><\/li><\/ul><\/nav><\/div>\n\n<p class=\"has-background\" style=\"background-color: rgb(241, 241, 239)\">&#x2b50; <strong>Bare Minimum Requirements<\/strong><\/p>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%AC%9B_%EC%84%9C%EB%B2%84_%EC%BD%94%EB%93%9C_%EC%9E%91%EC%84%B1\"><\/span>&#x2b1b; \uc11c\ubc84 \ucf54\ub4dc \uc791\uc131<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uc77d\uae30 <\/strong><span style=\"color: rgb(0, 0, 0)\"><strong>routes\/article\/read.js<\/strong><\/span><\/p>\n\n<\/blockquote>\n\n\n<pre class=\"wp-block-code\"><code>const { readAll, readOne } = require(&#039;..\/..\/model&#039;)\n\nmodule.exports = async function (app, opts) {\n  app.get(&#039;\/&#039;, async function (request, reply) {\n    \/\/ \uac8c\uc2dc\uae00 \uc804\uccb4 \uc870\ud68c\n    const result = await readAll()\n    \n    \/\/ \uc131\uacf5 \uacb0\uacfc \ucf54\ub4dc \ubc0f \uac8c\uc2dc\uae00 \ub370\uc774\ud130 \ubc18\ud658\n    reply\n      .code(200)\n      .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n      .send(result)\n  })\n\n  app.get(&#039;\/:id&#039;, async function (request, reply) {\n    const id = request.params.id\n    \n    \/\/ \ud2b9\uc815 ID\uc758 \uac8c\uc2dc\uae00 \uc870\ud68c\n    const result = await readOne(id)\n\n    \/\/ \ud574\ub2f9 ID\ub97c \uac00\uc9c4 \uac8c\uc2dc\uae00\uc774 \uc788\uc744 \ub54c\n    if(result) {\n      \/\/ \uc131\uacf5 \uacb0\uacfc \ucf54\ub4dc \ubc0f \uac8c\uc2dc\uae00 \ub370\uc774\ud130 \ubc18\ud658\n      reply\n        .code(200)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(result)\n    }\n    \/\/ \ud574\ub2f9 ID\ub97c \uac00\uc9c4 \uac8c\uc2dc\uae00\uc774 \uc5c6\uc744 \ub54c\n    else {\n      \/\/ 404 \uc2e4\ud328 \ucf54\ub4dc \ubc0f &quot;Article Not Found&quot; \uba54\uc2dc\uc9c0 \ubc18\ud658\n      reply\n        .code(404)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(&quot;Article Not Found&quot;)\n    }\n  })\n}<\/code><\/pre>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uc4f0\uae30 <\/strong><span style=\"color: rgb(0, 0, 0)\"><strong>routes\/article\/create.js<\/strong><\/span><\/p>\n\n<\/blockquote>\n\n\n<pre class=\"wp-block-code\"><code>const { createOne, isValid } = require(&#039;..\/..\/model&#039;)\n\nmodule.exports = async function (app, opts) {\n  app.post(&#039;\/&#039;, async function (request, reply) {\n    const body = request.body\n\n    \/\/ requestBody validation \uc2e4\ud328\uc2dc\n    if(!isValid(body)) {\n      \/\/ 400 \uc2e4\ud328 \ucf54\ub4dc \ubc0f &quot;Bad Request&quot; \uba54\uc2dc\uc9c0 \ubc18\ud658\n      reply\n        .code(400)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(&quot;Bad Request&quot;)\n\n      return;\n    }\n\n    \/\/ requestBody \ub370\uc774\ud130\ub85c \uc2e0\uaddc \uac8c\uc2dc\uae00 \uc0dd\uc131\n    const result = await createOne(body)\n\n    \/\/ \uac8c\uc2dc\uae00\uc774 \uc0dd\uc131\ub418\uc5c8\uc744 \ub54c\n    if(result) {\n      \/\/ \uc0dd\uc131 \uacb0\uacfc \ucf54\ub4dc \ubc0f \uac8c\uc2dc\uae00 \ub370\uc774\ud130 \ubc18\ud658\n      reply\n        .code(201)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(result)\n    \/\/ \uac8c\uc2dc\uae00\uc774 \uc0dd\uc131\ub418\uc9c0 \uc54a\uc558\uc744 \ub54c\n    } else {\n      reply\n        \/\/ 500 \uc2e4\ud328 \ucf54\ub4dc \ubc0f &quot;Server Error&quot; \uba54\uc2dc\uc9c0 \ubc18\ud658\n        .code(500)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(&quot;Server Error&quot;)\n    }\n  })\n}<\/code><\/pre>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uc0ad\uc81c <\/strong><span style=\"color: rgb(0, 0, 0)\"><strong>routes\/article\/delete.js<\/strong><\/span><\/p>\n\n<\/blockquote>\n\n\n<pre class=\"wp-block-code\"><code>const { deleteOne } = require(&#039;..\/..\/model&#039;)\n\nmodule.exports = async function (app, opts) {\n  app.delete(&#039;\/:id&#039;, async function (request, reply) {\n    \/\/ \ud2b9\uc815 ID\uc758 \uac8c\uc2dc\uae00 \uc0ad\uc81c\n    const result = await deleteOne(request.params.id)\n    \/\/ \ud574\ub2f9 ID\ub97c \uac00\uc9c4 \uac8c\uc2dc\uae00\uc744 \uc0ad\uc81c\ud588\uc744 \ub54c\n    if(result) {\n      \/\/ \uc0ad\uc81c \uacb0\uacfc \ucf54\ub4dc \ubc0f &quot;Delete Success&quot; \uba54\uc2dc\uc9c0 \ubc18\ud658\n      reply\n        .code(204)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(&quot;Delete Success&quot;)\n    }\n    \/\/ \ud574\ub2f9 ID\ub97c \uac00\uc9c4 \uac8c\uc2dc\uae00\uc774 \uc5c6\uc744 \ub54c\n    else {\n      \/\/ 404 \uc2e4\ud328 \ucf54\ub4dc \ubc0f &quot;Article Not Found&quot; \uba54\uc2dc\uc9c0 \ubc18\ud658\n      reply\n        .code(404)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(&quot;Article Not Found&quot;)\n    }\n  })\n}<\/code><\/pre>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uc218\uc815 <\/strong><span style=\"color: rgb(0, 0, 0)\"><strong>routes\/article\/update.js<\/strong><\/span><\/p>\n\n<\/blockquote>\n\n\n<pre class=\"wp-block-code\"><code>const { updateOne, isValid } = require(&#039;..\/..\/model&#039;)\n\nmodule.exports = async function (app, opts) {\n  app.put(&#039;\/:id&#039;, async function (request, reply) {\n    \/\/ requestBody validation \uc2e4\ud328\uc2dc\n    if(!isValid(request.body)) {\n      \/\/ 400 \uc2e4\ud328 \ucf54\ub4dc \ubc0f &quot;Bad Request&quot; \uba54\uc2dc\uc9c0 \ubc18\ud658\n      reply\n        .code(400)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(&quot;Bad Request&quot;)\n      \n      return;\n    }\n    \/\/ \ud2b9\uc815 ID\uc758 \uac8c\uc2dc\uae00\uc744 requestBody \ub370\uc774\ud130\ub85c \uc218\uc815\n    const result = await updateOne(request.params.id, request.body)\n\n    \/\/ \ud574\ub2f9 ID\ub97c \uac00\uc9c4 \uac8c\uc2dc\uae00\uc744 \uc218\uc815\ud588\uc744 \ub54c\n    if(result) {\n      \/\/ \uc131\uacf5 \uacb0\uacfc \ucf54\ub4dc \ubc0f \uac8c\uc2dc\uae00 \ub370\uc774\ud130 \ubc18\ud658\n      reply\n        .code(200)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(result)\n    }\n    else {\n      \/\/ 404 \uc2e4\ud328 \ucf54\ub4dc \ubc0f &quot;Article Not Found&quot; \uba54\uc2dc\uc9c0 \ubc18\ud658\n      reply\n        .code(404)\n        .header(&#039;Content-type&#039;, &#039;application\/json&#039;)\n        .send(&quot;Article Not Found&quot;)\n    }\n  })\n}<\/code><\/pre>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%AC%9B_%EA%B2%B0%EA%B3%BC_%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0\"><\/span>&#x2b1b; \uacb0\uacfc \ud655\uc778\ud558\uae30<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uac8c\uc2dc\uae00 \ubaa9\ub85d \uc870\ud68c<\/strong><\/p>\n\n<\/blockquote>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-174-1024x979.png?v=1688455654\" alt=\"\"\/><\/figure>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\ud2b9\uc815 \uac8c\uc2dc\uae00 \uc870\ud68c<\/strong><\/p>\n\n<\/blockquote>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-175-1024x987.png?v=1688455659\" alt=\"\"\/><\/figure>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uac8c\uc2dc\uae00 \uc0dd\uc131<\/strong><\/p>\n\n<\/blockquote>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-176-1024x504.png?v=1688455663\" alt=\"\"\/><\/figure>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-177-1024x1010.png?v=1688455668\" alt=\"\"\/><\/figure>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uac8c\uc2dc\uae00 \uc218\uc815<\/strong><\/p>\n\n<\/blockquote>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-178-1024x500.png?v=1688455672\" alt=\"\"\/><\/figure>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-179-1024x1007.png?v=1688455677\" alt=\"\"\/><\/figure>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uac8c\uc2dc\uae00 \uc0ad\uc81c<\/strong><\/p>\n\n<\/blockquote>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-180-1024x498.png?v=1688455681\" alt=\"\"\/><\/figure>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-181-1024x478.png?v=1688455685\" alt=\"\"\/><\/figure>\n\n","protected":false},"excerpt":{"rendered":"<p>&#x2b50; Bare Minimum Requirements &#x2b1b; \uc11c\ubc84 \ucf54\ub4dc \uc791\uc131 \uc77d\uae30 routes\/article\/read.js \uc4f0\uae30 routes\/article\/create.js \uc0ad\uc81c routes\/article\/delete.js \uc218\uc815 routes\/article\/update.js &#x2b1b; \uacb0\uacfc \ud655\uc778\ud558\uae30 \uac8c\uc2dc\uae00 \ubaa9\ub85d \uc870\ud68c \ud2b9\uc815 \uac8c\uc2dc\uae00 \uc870\ud68c \uac8c\uc2dc\uae00 \uc0dd\uc131 \uac8c\uc2dc\uae00 \uc218\uc815 \uac8c\uc2dc\uae00 \uc0ad\uc81c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":""},"categories":[45],"tags":[],"_links":{"self":[{"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1171"}],"collection":[{"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1171"}],"version-history":[{"count":1,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1171\/revisions"}],"predecessor-version":[{"id":1191,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1171\/revisions\/1191"}],"wp:attachment":[{"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}