{"id":1172,"date":"2023-03-28T21:54:40","date_gmt":"2023-03-28T12:54:40","guid":{"rendered":"https:\/\/www.gyuroot.com\/wordpress\/?p=1172"},"modified":"2023-07-04T22:12:51","modified_gmt":"2023-07-04T13:12:51","slug":"sprint-mini-was-%ea%b0%9c%eb%b0%9c-hands-on","status":"publish","type":"post","link":"https:\/\/www.gyuroot.com\/wordpress\/?p=1172","title":{"rendered":"[Sprint] Mini WAS \uac1c\ubc1c hands-on"},"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=1172\/#%E2%AC%9B_%EA%B0%84%EB%8B%A8%ED%95%9C_Express_%EC%84%9C%EB%B2%84_%EB%A7%8C%EB%93%A4%EA%B8%B0\" title=\"&#x2b1b; \uac04\ub2e8\ud55c Express \uc11c\ubc84 \ub9cc\ub4e4\uae30\">&#x2b1b; \uac04\ub2e8\ud55c Express \uc11c\ubc84 \ub9cc\ub4e4\uae30<\/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=1172\/#%E2%AC%9B_Mini_Node_Server_%EB%A7%8C%EB%93%A4%EA%B8%B0\" title=\"&#x2b1b; Mini Node Server \ub9cc\ub4e4\uae30\">&#x2b1b; Mini Node Server \ub9cc\ub4e4\uae30<\/a><\/li><\/ul><\/nav><\/div>\n\n<p class=\"has-background\" style=\"background-color: rgb(241, 241, 239)\">&#x2b50; <strong>Achievement Goals<\/strong><\/p>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%AC%9B_%EA%B0%84%EB%8B%A8%ED%95%9C_Express_%EC%84%9C%EB%B2%84_%EB%A7%8C%EB%93%A4%EA%B8%B0\"><\/span>&#x2b1b; \uac04\ub2e8\ud55c Express \uc11c\ubc84 \ub9cc\ub4e4\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>Express \uc124\uce58<\/strong><\/p>\n\n<\/blockquote>\n\n\n<pre class=\"wp-block-code\"><code># myapp \ub514\ub809\ud1a0\ub9ac \uc0dd\uc131\n$ cd myapp\n# npm project \ucd08\uae30\ud654\n$ npm init\npackage name: (myapp) myapp\nversion: (1.0.0) 1.0.0\ndescription: my first app\nentry point: (index.js) app.js\ntest command: \ngit repository: \nkeywords: \nauthor: \nlicense: (ISC)\n# package.json \ud30c\uc77c \uc0dd\uc131 \ud655\uc778\n$ ls\npackage.json\n# express \uc124\uce58\n$ npm install express --save\n# node_modules \ub514\ub809\ud1a0\ub9ac \uc0dd\uc131 \ud655\uc778\n# package-lock.json \ud30c\uc77c \uc0dd\uc131 \ud655\uc778\n$ ls\nnode_modules  package.json  package-lock.json<\/code><\/pre>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>Hello world \uc608\uc81c \uad6c\ud604\ud558\uae30<\/strong><\/p>\n\n<\/blockquote>\n\n\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\"><strong>app.js<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\"><code>const express = require(&#039;express&#039;)\nconst app = express()\nconst port = 3000\n\napp.get(&#039;\/&#039;, (req, res) =&gt; {\n  res.send(&#039;Hello World!&#039;)\n})\n\napp.listen(port, () =&gt; {\n  console.log(`Example app listening on port ${port}`)\n})<\/code><\/pre>\n\n\n<pre class=\"wp-block-code\"><code># app.js \uc2e4\ud589 -&gt; 3000\ubc88 \ud3ec\ud2b8\uac00 open \ub41c\ub2e4.\n$ node app.js<\/code><\/pre>\n\n\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\"><strong>\ud398\uc774\uc9c0 \ud655\uc778\ud558\uae30<\/strong><\/p>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-171.png?v=1688455642\" alt=\"\"\/><\/figure>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%AC%9B_Mini_Node_Server_%EB%A7%8C%EB%93%A4%EA%B8%B0\"><\/span>&#x2b1b; <strong>Mini Node Server \ub9cc\ub4e4\uae30<\/strong><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>Mini Node Server API<\/strong><\/p>\n\n<\/blockquote>\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Endpoint(<span class='tooltipsall tooltipsincontent classtoolTips11'>URL<\/span>)<\/strong><\/td><td><strong>Method<\/strong><\/td><td><strong>\uae30\ub2a5<\/strong><\/td><\/tr><tr><td>\/lower<\/td><td>POST<\/td><td>\ubb38\uc790\uc5f4\uc744 \uc18c\ubb38\uc790\ub85c \ub9cc\ub4e4\uc5b4 \uc751\ub2f5\ud574\uc57c \ud569\ub2c8\ub2e4<\/td><\/tr><tr><td>\/upper<\/td><td>POST<\/td><td>\ubb38\uc790\uc5f4\uc744 \ub300\ubb38\uc790\ub85c \ub9cc\ub4e4\uc5b4 \uc751\ub2f5\ud574\uc57c \ud569\ub2c8\ub2e4<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>Mini Node Server \uc694\uad6c\uc0ac\ud56d<\/strong><\/p>\n\n<\/blockquote>\n\n\n<ul>\n<li>POST\uc5d0 \ubb38\uc790\uc5f4\uc744 \ub2f4\uc544 \uc694\uccad\uc744 \ubcf4\ub0bc \ub54c\ub294 HTTP \uba54\uc2dc\uc9c0\uc758 body(payload)\ub97c \uc774\uc6a9\ud569\ub2c8\ub2e4.<\/li>\n\n\n<li>\uc11c\ubc84\ub294 \uc694\uccad\uc5d0 \ub530\ub978 \uc801\uc808\ud55c \uc751\ub2f5\uc744 \ud074\ub77c\uc774\uc5b8\ud2b8\ub85c \ubcf4\ub0b4\uc57c \ud569\ub2c8\ub2e4.<\/li>\n\n\n<li>\uc11c\ubc84\ub294 POST \uc694\uccad \uc774\uc678\uc758 \ub2e4\ub978 \ubaa8\ub4e0 \uc694\uccad\uc5d0 \ub300\ud558\uc5ec, \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0 \uc798\ubabb\ub41c \uc694\uccad\uc774\ub77c\uace0 \uc54c\ub824\uc904 \uc218 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/li>\n\n\n<li>CORS \uad00\ub828 \uc124\uc815\uc744 \uc801\uc6a9\ud574\uc57c \ud569\ub2c8\ub2e4.<\/li>\n\n<\/ul>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>Mini Node Server \uc11c\ubc84 \uc791\uc131<\/strong><\/p>\n\n<\/blockquote>\n\n\n<pre class=\"wp-block-code\"><code>const express = require(&#039;express&#039;);\nconst app = express();\nconst port = 4000;\nconst ip = &#039;10.0.0.48&#039;;\nconst cors = require(&#039;cors&#039;);\n\n\/\/ TODO: CORS \ubaa8\ub4c8\uc744 \uc0ac\uc6a9\ud558\uae30 \uc704\ud55c \ucf54\ub4dc\ub97c \uc791\uc131\ud558\uc138\uc694 \nconst allowedMethods = [&#039;POST&#039;]; \/\/ POST method\ub9cc \ud5c8\uc6a9\n\nconst corsOptions = {\n  origin: true, \/\/ \ubaa8\ub4e0 origin \uc694\uccad \ud5c8\uc6a9\n  methods: allowedMethods,\n  preflightContinue: false, \/\/ preflight \uc694\uccad\uc774 \uc131\uacf5\ud574\uc57c\ub9cc \uc774\ud6c4 \uc694\uccad \uc9c4\ud589\n  optionsSuccessStatus: 204, \/\/ preflight \uc694\uccad\uc5d0 \ub300\ud55c \uc131\uacf5 Status Code\n};\n\n\/\/ cors \uc801\uc6a9\napp.use(cors(corsOptions))\n\napp.options(&#039;*&#039;, cors(corsOptions));\n\napp.use(express.json({&quot;strict&quot;:false}));\n\napp.get(&#039;\/&#039;, (req, res) =&gt; {\n  res.send(&quot;Hello World!&quot;)\n})\n\n\/\/ TODO: \uc544\ub798\uc5d0 &#039;\/upper&#039;\ub85c \ub4e4\uc5b4\uc624\ub294 \uc694\uccad\uc744 \ucc98\ub9ac\ud558\ub294 \ucf54\ub4dc\ub97c \uc791\uc131\ud558\uc138\uc694. \napp.post(&#039;\/upper&#039;, (req, res) =&gt; {\n  \/\/ request body \ub0b4\uc6a9\uc744 \ub300\ubb38\uc790\ub85c \ubcc0\uacbd\ud558\uc5ec \ubc18\ud658\n  let data = req.body.toUpperCase();\n  res.json(data);\n})\n\n\/\/ TODO: \uc544\ub798\uc5d0 &#039;\/lower&#039;\ub85c \ub4e4\uc5b4\uc624\ub294 \uc694\uccad\uc744 \ucc98\ub9ac\ud558\ub294 \ucf54\ub4dc\ub97c \uc791\uc131\ud558\uc138\uc694. \napp.post(&#039;\/lower&#039;, (req, res) =&gt; {\n  \/\/ request body \ub0b4\uc6a9\uc744 \uc18c\ubb38\uc790\ub85c \ubcc0\uacbd\ud558\uc5ec \ubc18\ud658\n  let data = req.body.toLowerCase();\n  res.json(data);\n})\n\napp.listen(port, () =&gt; {\n  console.log(`Server listening on http:\/\/${ip}:${port}`)\n})<\/code><\/pre>\n\n\n<blockquote class=\"wp-block-quote has-text-color\" style=\"color: rgb(0, 0, 0)\">\n<p><strong>\uacb0\uacfc \ud655\uc778\ud558\uae30<\/strong><\/p>\n\n<\/blockquote>\n\n\n<pre class=\"wp-block-code\"><code># client \uc2e4\ud589\n$ npx serve .\/client -l 3000<\/code><\/pre>\n\n\n<pre class=\"wp-block-code\"><code># server \uc2e4\ud589\n$ npm start<\/code><\/pre>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-3\">\n<div class=\"wp-block-column is-layout-flow\">\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\"><strong>toUpperCase<\/strong><\/p>\n\n<\/div>\n\n\n<div class=\"wp-block-column is-layout-flow\">\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\"><strong>toLowerCase<\/strong><\/p>\n\n<\/div>\n\n<\/div>\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-6\">\n<div class=\"wp-block-column is-layout-flow\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-172.png?v=1688455645\" alt=\"\"\/><\/figure>\n\n<\/div>\n\n\n<div class=\"wp-block-column is-layout-flow\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/www.gyuroot.com\/wordpress\/wp-content\/uploads\/image-173.png?v=1688455648\" alt=\"\"\/><\/figure>\n\n<\/div>\n\n<\/div>\n\n<script type=\"text\/javascript\"> toolTips('.classtoolTips11','<span class=\"notion-enable-hover\" data-token-index=\"0\">Uniform Resource Locator<br\/><\/span><br\/><br\/><a href=\"\/wordpress\/?p=65\">Detail<\/a>'); <\/script>","protected":false},"excerpt":{"rendered":"<p>&#x2b50; Achievement Goals &#x2b1b; \uac04\ub2e8\ud55c Express \uc11c\ubc84 \ub9cc\ub4e4\uae30 Express \uc124\uce58 Hello world \uc608\uc81c \uad6c\ud604\ud558\uae30 app.js \ud398\uc774\uc9c0 \ud655\uc778\ud558\uae30 &#x2b1b; Mini Node Server \ub9cc\ub4e4\uae30 Mini Node Server API Endpoint(URL) Method \uae30\ub2a5 \/lower POST \ubb38\uc790\uc5f4\uc744 \uc18c\ubb38\uc790\ub85c \ub9cc\ub4e4\uc5b4 \uc751\ub2f5\ud574\uc57c \ud569\ub2c8\ub2e4 \/upper POST \ubb38\uc790\uc5f4\uc744 \ub300\ubb38\uc790\ub85c \ub9cc\ub4e4\uc5b4 \uc751\ub2f5\ud574\uc57c \ud569\ub2c8\ub2e4 Mini Node Server \uc694\uad6c\uc0ac\ud56d Mini Node Server \uc11c\ubc84 \uc791\uc131 \uacb0\uacfc \ud655\uc778\ud558\uae30 toUpperCase &#8230; <a title=\"[Sprint] Mini WAS \uac1c\ubc1c hands-on\" class=\"read-more\" href=\"https:\/\/www.gyuroot.com\/wordpress\/?p=1172\" aria-label=\"More on [Sprint] Mini WAS \uac1c\ubc1c hands-on\">Read more<\/a><\/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\/1172"}],"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=1172"}],"version-history":[{"count":1,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1172\/revisions"}],"predecessor-version":[{"id":1192,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1172\/revisions\/1192"}],"wp:attachment":[{"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gyuroot.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}