{"id":38376,"date":"2024-11-01T17:18:01","date_gmt":"2024-11-01T17:18:01","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=38376"},"modified":"2024-11-26T06:44:29","modified_gmt":"2024-11-26T06:44:29","slug":"express-%ea%b0%9c%eb%b0%9c-%ea%b0%95%ec%a2%8c-%ea%b8%b0%eb%b3%b8-%eb%af%b8%eb%93%a4%ec%9b%a8%ec%96%b4-%ec%82%ac%ec%9a%a9-body-parser-cookie-parser-%eb%93%b1","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/38376\/","title":{"rendered":"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)"},"content":{"rendered":"<p><body><\/p>\n<p>\uc774\ubc88 \uac15\uc88c\uc5d0\uc11c\ub294 Node.js\uc758 \uc720\uba85\ud55c \uc6f9 \ud504\ub808\uc784\uc6cc\ud06c\uc778 <strong>Express<\/strong>\ub97c \uc0ac\uc6a9\ud558\uc5ec \uae30\ubcf8\uc801\uc778 \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \ud65c\uc6a9\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uaca0\uc2b5\ub2c8\ub2e4. Express\ub294 RESTful API \uc11c\ubc84 \ubc0f \uc6f9 \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uad6c\ucd95\ud558\ub294 \ub370 \ub9e4\uc6b0 \uc801\ud569\ud55c \ud504\ub808\uc784\uc6cc\ud06c\uc774\uba70, \uac15\ub825\ud55c \ubbf8\ub4e4\uc6e8\uc5b4 \uc2dc\uc2a4\ud15c\uc744 \uac16\ucd94\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc694\uccad\uacfc \uc751\ub2f5 \uac1d\uccb4\ub97c \ucc98\ub9ac\ud558\ub294 \ud568\uc218\ub85c, \ub2e4\uc591\ud55c \uae30\ub2a5\ub4e4\uc744 \uc81c\uacf5\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<h2>1. \ubbf8\ub4e4\uc6e8\uc5b4\ub780?<\/h2>\n<p>\ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc694\uccad(request)\uacfc \uc11c\ubc84\uc758 \uc751\ub2f5(response) \uc0ac\uc774\uc5d0\uc11c \uc911\uac1c \uc5ed\ud560\uc744 \uc218\ud589\ud558\ub294 \ud568\uc218\uc785\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc5ec\ub7ec \uac00\uc9c0 \uc6a9\ub3c4\ub85c \uc0ac\uc6a9\ub420 \uc218 \uc788\ub294\ub370, \uc5ec\uae30\uc5d0\ub294 \uc694\uccad \ub370\uc774\ud130\uc758 \ucc98\ub9ac, \uc0ac\uc6a9\uc790 \uc778\uc99d \ubc0f \ubcf4\uc548 \uccb4\ud06c, \ub85c\uadf8 \uae30\ub85d \ubc0f \uc624\ub958 \ucc98\ub9ac \ub4f1\uc774 \ud3ec\ud568\ub429\ub2c8\ub2e4.<\/p>\n<h2>2. Express\uc5d0\uc11c \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9\ud558\uae30<\/h2>\n<p>Express\ub294 <code>app.use()<\/code> \uba54\uc11c\ub4dc\ub97c \ud1b5\ud574 \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \ub4f1\ub85d\ud569\ub2c8\ub2e4. \uc774 \uba54\uc11c\ub4dc\ub294 \uc694\uccad\uc774 \ub4e4\uc5b4\uc62c \ub54c\ub9c8\ub2e4 \uc2e4\ud589\ub418\uba70, \uc21c\ucc28\uc801\uc73c\ub85c \ub4f1\ub85d\ub41c \ubbf8\ub4e4\uc6e8\uc5b4\uac00 \uc2e4\ud589\ub429\ub2c8\ub2e4.<\/p>\n<h2>3. \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc124\uce58 \ubc0f \uc124\uc815<\/h2>\n<p> Express\uc758 \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc911 \ub450 \uac00\uc9c0\uc778 <strong>body-parser<\/strong>\uc640 <strong>cookie-parser<\/strong>\ub97c \uc124\uce58\ud558\uace0 \uc124\uc815\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uaca0\uc2b5\ub2c8\ub2e4.<\/p>\n<h3>3.1 body-parser<\/h3>\n<p><strong>body-parser<\/strong> \ubbf8\ub4e4\uc6e8\uc5b4\ub294 HTTP \uc694\uccad \ubcf8\ubb38\uc744 \uad6c\ubb38 \ubd84\uc11d\ud558\uc5ec \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \uac1d\uccb4\ub85c \ubcc0\ud658\ud574\uc8fc\ub294 \uae30\ub2a5\uc744 \ud569\ub2c8\ub2e4. \uc77c\ubc18\uc801\uc73c\ub85c JSON \ud615\ud0dc\uc758 \ub370\uc774\ud130\ub97c \uc27d\uac8c \ucc98\ub9ac\ud560 \uc218 \uc788\ub3c4\ub85d \ub3d5\uc2b5\ub2c8\ub2e4.<\/p>\n<pre><code>npm install body-parser<\/code><\/pre>\n<h4>3.1.1 body-parser \uc124\uc815 \uc608\uc81c<\/h4>\n<p>\ub2e4\uc74c\uc740 body-parser\ub97c \uc0ac\uc6a9\ud558\ub294 \uac04\ub2e8\ud55c \uc124\uc815 \uc608\uc81c\uc785\ub2c8\ub2e4.<\/p>\n<pre><code>const express = require('express');\nconst bodyParser = require('body-parser');\n\nconst app = express();\nconst PORT = 3000;\n\n\/\/ body-parser \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9\napp.use(bodyParser.json()); \/\/ JSON \ud615\ud0dc\uc758 \ub370\uc774\ud130 \ud30c\uc2f1\napp.use(bodyParser.urlencoded({ extended: true })); \/\/ URL \uc778\ucf54\ub529 \ub370\uc774\ud130 \ud30c\uc2f1\n\napp.post('\/api\/data', (req, res) =&gt; {\n    console.log(req.body); \/\/ \ud30c\uc2f1\ub41c \ub370\uc774\ud130 \ub85c\uadf8 \ucd9c\ub825\n    res.send('\ub370\uc774\ud130 \uc218\uc2e0 \uc644\ub8cc');\n});\n\napp.listen(PORT, () =&gt; {\n    console.log(`\uc11c\ubc84\uac00 http:\/\/localhost:${PORT} \uc5d0\uc11c \uc2dc\uc791\ub418\uc5c8\uc2b5\ub2c8\ub2e4.`);\n});<\/code><\/pre>\n<p>\uc704 \uc608\uc81c\uc5d0\uc11c <code>bodyParser.json()<\/code> \uba54\uc11c\ub4dc\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \ubcf4\ub0b4\ub294 JSON \ud615\ud0dc\uc758 \uc694\uccad \ubcf8\ubb38\uc744 \ud30c\uc2f1\ud558\uace0, <code>bodyParser.urlencoded()<\/code> \uba54\uc11c\ub4dc\ub294 URL \uc778\ucf54\ub529\ub41c \ub370\uc774\ud130\ub97c \ud30c\uc2f1\ud569\ub2c8\ub2e4.<\/p>\n<h3>3.2 cookie-parser<\/h3>\n<p><strong>cookie-parser<\/strong> \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc694\uccad\uc5d0\uc11c \ucfe0\ud0a4\ub97c \ud30c\uc2f1\ud558\uc5ec <code>req.cookies<\/code> \uac1d\uccb4\uc5d0 \uc800\uc7a5\ud558\ub294 \uae30\ub2a5\uc744 \ud569\ub2c8\ub2e4. \uc774 \uae30\ub2a5\uc740 \uc0ac\uc6a9\uc790\uc758 \uc0c1\ud0dc\ub97c \uc800\uc7a5\ud558\uace0 \uad00\ub9ac\ud558\ub294 \ub370 \uc720\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n<pre><code>npm install cookie-parser<\/code><\/pre>\n<h4>3.2.1 cookie-parser \uc124\uc815 \uc608\uc81c<\/h4>\n<p>\ub2e4\uc74c\uc740 cookie-parser\ub97c \uc0ac\uc6a9\ud558\ub294 \uac04\ub2e8\ud55c \uc124\uc815 \uc608\uc81c\uc785\ub2c8\ub2e4.<\/p>\n<pre><code>const express = require('express');\nconst cookieParser = require('cookie-parser');\n\nconst app = express();\nconst PORT = 3000;\n\n\/\/ cookie-parser \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9\napp.use(cookieParser());\n\napp.get('\/set-cookie', (req, res) =&gt; {\n    res.cookie('myCookie', 'testValue', { maxAge: 900000, httpOnly: true });\n    res.send('\ucfe0\ud0a4\uac00 \uc124\uc815\ub418\uc5c8\uc2b5\ub2c8\ub2e4.');\n});\n\napp.get('\/get-cookie', (req, res) =&gt; {\n    console.log(req.cookies); \/\/ \uc800\uc7a5\ub41c \ucfe0\ud0a4 \ub85c\uadf8 \ucd9c\ub825\n    res.send('\ucfe0\ud0a4 \uac12\uc744 \ud655\uc778\ud558\uc600\uc2b5\ub2c8\ub2e4.');\n});\n\napp.listen(PORT, () =&gt; {\n    console.log(`\uc11c\ubc84\uac00 http:\/\/localhost:${PORT} \uc5d0\uc11c \uc2dc\uc791\ub418\uc5c8\uc2b5\ub2c8\ub2e4.`);\n});<\/code><\/pre>\n<p>\uc704 \uc608\uc81c\uc5d0\uc11c <code>res.cookie()<\/code> \uba54\uc11c\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc5ec \ucfe0\ud0a4\ub97c \uc124\uc815\ud558\uace0, <code>req.cookies<\/code>\ub97c \ud1b5\ud574 \uc694\uccad\uc5d0 \ud3ec\ud568\ub41c \ucfe0\ud0a4 \uac12\uc744 \ud655\uc778\ud569\ub2c8\ub2e4. \ucfe0\ud0a4\ub294 \uc0ac\uc6a9\uc790\uc758 \uc138\uc158 \uc815\ubcf4\ub97c \uc800\uc7a5\ud558\uac70\ub098, \uac1c\uc778\ud654\ub41c \uc0ac\uc6a9\uc790 \uacbd\ud5d8\uc744 \uc81c\uacf5\ud558\ub294 \ub370 \uc790\uc8fc \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/p>\n<h2>4. \uc2e4\uc2b5 \uc608\uc81c: \ubbf8\ub4e4\uc6e8\uc5b4 \ud1b5\ud569\ud558\uae30<\/h2>\n<p>\uc774\uc81c body-parser\uc640 cookie-parser\ub97c \ubaa8\ub450 \uc0ac\uc6a9\ud558\ub294 \uc608\uc81c\ub97c \ub9cc\ub4e4\uc5b4 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4. \uc774 \uc608\uc81c\ub294 \uc0ac\uc6a9\uc790\ub85c\ubd80\ud130 \ub370\uc774\ud130\ub97c \ubc1b\uc544\uc640 \ucfe0\ud0a4\uc5d0 \uc800\uc7a5\ud558\uace0, \ud6c4\uc5d0 \uadf8 \ub370\uc774\ud130\ub97c \uc77d\uc5b4\uc624\ub294 API\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4.<\/p>\n<pre><code>const express = require('express');\nconst bodyParser = require('body-parser');\nconst cookieParser = require('cookie-parser');\n\nconst app = express();\nconst PORT = 3000;\n\napp.use(bodyParser.json());\napp.use(bodyParser.urlencoded({ extended: true }));\napp.use(cookieParser());\n\napp.post('\/submit', (req, res) =&gt; {\n    const { username } = req.body; \/\/ \uc694\uccad \ubcf8\ubb38\uc5d0\uc11c username \ucd94\ucd9c\n    res.cookie('username', username, { maxAge: 900000, httpOnly: true });\n    res.send('\uc0ac\uc6a9\uc790 \uc774\ub984\uc774 \ucfe0\ud0a4\uc5d0 \uc800\uc7a5\ub418\uc5c8\uc2b5\ub2c8\ub2e4.');\n});\n\napp.get('\/welcome', (req, res) =&gt; {\n    const username = req.cookies.username; \/\/ \ucfe0\ud0a4\uc5d0\uc11c \uc0ac\uc6a9\uc790 \uc774\ub984 \ucd94\ucd9c\n    if (username) {\n        res.send(`\ud658\uc601\ud569\ub2c8\ub2e4, ${username}\ub2d8!`);\n    } else {\n        res.send('\ucfe0\ud0a4\uc5d0 \uc800\uc7a5\ub41c \uc0ac\uc6a9\uc790 \uc774\ub984\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.');\n    }\n});\n\napp.listen(PORT, () =&gt; {\n    console.log(`\uc11c\ubc84\uac00 http:\/\/localhost:${PORT} \uc5d0\uc11c \uc2dc\uc791\ub418\uc5c8\uc2b5\ub2c8\ub2e4.`);\n});<\/code><\/pre>\n<p>\uc704 \uc608\uc81c\uc5d0\uc11c \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 <code>\/submit<\/code> \uacbd\ub85c\ub85c POST \uc694\uccad\uc744 \ud558\uba74, \uc0ac\uc6a9\uc790 \uc774\ub984\uc744 \ucfe0\ud0a4\uc5d0 \uc800\uc7a5\ud558\uace0, <code>\/welcome<\/code> \uacbd\ub85c\ub85c GET \uc694\uccad\uc744 \ud558\uba74 \uc800\uc7a5\ub41c \uc0ac\uc6a9\uc790 \uc774\ub984\uc744 \uc751\ub2f5\uc73c\ub85c \ub3cc\ub824\uc90d\ub2c8\ub2e4.<\/p>\n<h2>5. \ubbf8\ub4e4\uc6e8\uc5b4 \uccb4\uc774\ub2dd<\/h2>\n<p>Express\uc5d0\uc11c\ub294 \uc5ec\ub7ec \uac1c\uc758 \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \uccb4\uc774\ub2dd\ud558\uc5ec \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uccb4\uc774\ub2dd\uc744 \ud1b5\ud574 \uc694\uccad\uc744 \ud6a8\uc728\uc801\uc73c\ub85c \ucc98\ub9ac\ud558\uace0, \ucf54\ub4dc\uc758 \uac00\ub3c5\uc131\uc744 \ub192\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc544\ub798\ub294 \ubbf8\ub4e4\uc6e8\uc5b4 \uccb4\uc774\ub2dd\uc758 \uc608\uc785\ub2c8\ub2e4.<\/p>\n<pre><code>const express = require('express');\n\nconst app = express();\nconst PORT = 3000;\n\nconst logRequest = (req, res, next) =&gt; {\n    console.log(`${req.method} ${req.url}`);\n    next(); \/\/ \ub2e4\uc74c \ubbf8\ub4e4\uc6e8\uc5b4\ub85c \uc774\ub3d9\n};\n\napp.use(logRequest);\n\napp.get('\/', (req, res) =&gt; {\n    res.send('\ud648\ud398\uc774\uc9c0');\n});\n\napp.listen(PORT, () =&gt; {\n    console.log(`\uc11c\ubc84\uac00 http:\/\/localhost:${PORT} \uc5d0\uc11c \uc2dc\uc791\ub418\uc5c8\uc2b5\ub2c8\ub2e4.`);\n});<\/code><\/pre>\n<p>\uc704 \uc608\uc81c\uc5d0\uc11c <code>logRequest<\/code> \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ubaa8\ub4e0 \uc694\uccad\uc5d0 \ub300\ud574 \uc694\uccad \uba54\uc11c\ub4dc\uc640 URL\uc744 \ub85c\uadf8\ub85c \ucd9c\ub825\ud569\ub2c8\ub2e4. <code>next()<\/code> \ud638\ucd9c \uc5c6\uc774 \ubbf8\ub4e4\uc6e8\uc5b4\uac00 \uc885\ub8cc\ub41c\ub2e4\uba74, \uc774\ud6c4\uc758 \ubbf8\ub4e4\uc6e8\uc5b4\ub098 \ub77c\uc6b0\ud130\uac00 \uc2e4\ud589\ub418\uc9c0 \uc54a\uc73c\ubbc0\ub85c, \ud56d\uc0c1 <code>next()<\/code>\ub97c \ud638\ucd9c\ud574 \uc8fc\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<h2>6. \uc5d0\ub7ec \ucc98\ub9ac \ubbf8\ub4e4\uc6e8\uc5b4<\/h2>\n<p>Express\uc5d0\uc11c\ub294 \uc5d0\ub7ec \ucc98\ub9ac\ub97c \uc704\ud55c \ud2b9\ubcc4\ud55c \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4. \uc5d0\ub7ec \ucc98\ub9ac \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ud56d\uc0c1 \ub124 \uac1c\uc758 \uc778\uc790\ub97c \uac00\uc9d1\ub2c8\ub2e4: <code>(err, req, res, next)<\/code>. \uc608\ub97c \ub4e4\uc5b4, \ub2e4\uc74c\uc740 \uae30\ubcf8\uc801\uc778 \uc5d0\ub7ec \ucc98\ub9ac \ubbf8\ub4e4\uc6e8\uc5b4\uc758 \uc608\uc785\ub2c8\ub2e4.<\/p>\n<pre><code>const express = require('express');\n\nconst app = express();\nconst PORT = 3000;\n\napp.get('\/', (req, res) =&gt; {\n    throw new Error('\uc5d0\ub7ec \ubc1c\uc0dd!'); \/\/ \uac15\uc81c\ub85c \uc624\ub958 \ubc1c\uc0dd\n});\n\n\/\/ \uc5d0\ub7ec \ucc98\ub9ac \ubbf8\ub4e4\uc6e8\uc5b4\napp.use((err, req, res, next) =&gt; {\n    console.error(err.stack);\n    res.status(500).send('\ubb34\uc5b8\uac00 \uc798\ubabb\ub418\uc5c8\uc2b5\ub2c8\ub2e4!');\n});\n\napp.listen(PORT, () =&gt; {\n    console.log(`\uc11c\ubc84\uac00 http:\/\/localhost:${PORT} \uc5d0\uc11c \uc2dc\uc791\ub418\uc5c8\uc2b5\ub2c8\ub2e4.`);\n});<\/code><\/pre>\n<p>\uc704 \uc608\uc81c\uc5d0\uc11c\ub294 <code>\/<\/code> \uacbd\ub85c\uc5d0\uc11c \uc758\ub3c4\uc801\uc73c\ub85c \uc624\ub958\ub97c \ubc1c\uc0dd\uc2dc\ucf1c, \uc774\ud6c4\uc5d0 \uc815\uc758\ub41c \uc5d0\ub7ec \ucc98\ub9ac \ubbf8\ub4e4\uc6e8\uc5b4\uac00 \ud638\ucd9c\ub418\ub3c4\ub85d \ud558\uc600\uc2b5\ub2c8\ub2e4. \uc5d0\ub7ec \ucc98\ub9ac \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ucf58\uc194\uc5d0 \uc624\ub958 \uc2a4\ud0dd\uc744 \ucd9c\ub825\ud558\uace0, \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uac8c 500 \uc0c1\ud0dc \ucf54\ub4dc\ub97c \uc751\ub2f5\uc73c\ub85c \ub3cc\ub824\uc90d\ub2c8\ub2e4.<\/p>\n<h2>7. \ub9c8\uce58\uba70<\/h2>\n<p>\uc774\ubc88 \uac15\uc88c\uc5d0\uc11c\ub294 Express\uc758 \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9\ubc95\uc5d0 \ub300\ud574 \uc54c\uc544\ubcf4\uc558\uc2b5\ub2c8\ub2e4. <strong>body-parser<\/strong>\uc640 <strong>cookie-parser<\/strong>\ub97c \ud1b5\ud574 \uc694\uccad \ubcf8\ubb38 \ubc0f \ucfe0\ud0a4\ub97c \ucc98\ub9ac\ud558\ub294 \ubc29\ubc95\uc744 \ubc30\uc6e0\uc73c\uba70, \ubbf8\ub4e4\uc6e8\uc5b4 \uccb4\uc774\ub2dd \ubc0f \uc5d0\ub7ec \ucc98\ub9ac \ubbf8\ub4e4\uc6e8\uc5b4\uc758 \uc911\uc694\uc131\ub3c4 \ud655\uc778\ud558\uc600\uc2b5\ub2c8\ub2e4. Express \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc6f9 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \uc694\uccad \ucc98\ub9ac\uc5d0\uc11c \ub9e4\uc6b0 \uc911\uc694\ud55c \uc5ed\ud560\uc744 \ud558\ubbc0\ub85c, \uc81c\ub300\ub85c \uc774\ud574\ud558\uace0 \ud65c\uc6a9\ud558\ub294 \uac83\uc774 \uc911\uc694\ud569\ub2c8\ub2e4.<\/p>\n<p>\ub354 \ub098\uc544\uac00, \uc790\uc2e0\ub9cc\uc758 \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \ub9cc\ub4e4\uc5b4\ubcf4\uac70\ub098, \ub2e4\uc591\ud55c \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \ud65c\uc6a9\ud558\uc5ec Express \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ud655\uc7a5\ud574 \ub098\uac00\uae38 \ucd94\ucc9c\ud569\ub2c8\ub2e4. \uac10\uc0ac\ud569\ub098\ub2e4!<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc774\ubc88 \uac15\uc88c\uc5d0\uc11c\ub294 Node.js\uc758 \uc720\uba85\ud55c \uc6f9 \ud504\ub808\uc784\uc6cc\ud06c\uc778 Express\ub97c \uc0ac\uc6a9\ud558\uc5ec \uae30\ubcf8\uc801\uc778 \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \ud65c\uc6a9\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uaca0\uc2b5\ub2c8\ub2e4. Express\ub294 RESTful API \uc11c\ubc84 \ubc0f \uc6f9 \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uad6c\ucd95\ud558\ub294 \ub370 \ub9e4\uc6b0 \uc801\ud569\ud55c \ud504\ub808\uc784\uc6cc\ud06c\uc774\uba70, \uac15\ub825\ud55c \ubbf8\ub4e4\uc6e8\uc5b4 \uc2dc\uc2a4\ud15c\uc744 \uac16\ucd94\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc694\uccad\uacfc \uc751\ub2f5 \uac1d\uccb4\ub97c \ucc98\ub9ac\ud558\ub294 \ud568\uc218\ub85c, \ub2e4\uc591\ud55c \uae30\ub2a5\ub4e4\uc744 \uc81c\uacf5\ud574 \uc90d\ub2c8\ub2e4. 1. \ubbf8\ub4e4\uc6e8\uc5b4\ub780? \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc694\uccad(request)\uacfc \uc11c\ubc84\uc758 \uc751\ub2f5(response) \uc0ac\uc774\uc5d0\uc11c \uc911\uac1c \uc5ed\ud560\uc744 \uc218\ud589\ud558\ub294 \ud568\uc218\uc785\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc5ec\ub7ec \uac00\uc9c0 &hellip; <a href=\"https:\/\/atmokpo.com\/w\/38376\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[181],"tags":[],"class_list":["post-38376","post","type-post","status-publish","format-standard","hentry","category-express"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1) - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/38376\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1) - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"\uc774\ubc88 \uac15\uc88c\uc5d0\uc11c\ub294 Node.js\uc758 \uc720\uba85\ud55c \uc6f9 \ud504\ub808\uc784\uc6cc\ud06c\uc778 Express\ub97c \uc0ac\uc6a9\ud558\uc5ec \uae30\ubcf8\uc801\uc778 \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \ud65c\uc6a9\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uaca0\uc2b5\ub2c8\ub2e4. Express\ub294 RESTful API \uc11c\ubc84 \ubc0f \uc6f9 \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uad6c\ucd95\ud558\ub294 \ub370 \ub9e4\uc6b0 \uc801\ud569\ud55c \ud504\ub808\uc784\uc6cc\ud06c\uc774\uba70, \uac15\ub825\ud55c \ubbf8\ub4e4\uc6e8\uc5b4 \uc2dc\uc2a4\ud15c\uc744 \uac16\ucd94\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc694\uccad\uacfc \uc751\ub2f5 \uac1d\uccb4\ub97c \ucc98\ub9ac\ud558\ub294 \ud568\uc218\ub85c, \ub2e4\uc591\ud55c \uae30\ub2a5\ub4e4\uc744 \uc81c\uacf5\ud574 \uc90d\ub2c8\ub2e4. 1. \ubbf8\ub4e4\uc6e8\uc5b4\ub780? \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc694\uccad(request)\uacfc \uc11c\ubc84\uc758 \uc751\ub2f5(response) \uc0ac\uc774\uc5d0\uc11c \uc911\uac1c \uc5ed\ud560\uc744 \uc218\ud589\ud558\ub294 \ud568\uc218\uc785\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc5ec\ub7ec \uac00\uc9c0 &hellip; \ub354 \ubcf4\uae30 &quot;Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/38376\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T17:18:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-26T06:44:29+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/38376\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/38376\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)\",\"datePublished\":\"2024-11-01T17:18:01+00:00\",\"dateModified\":\"2024-11-26T06:44:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/38376\/\"},\"wordCount\":41,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Express\uc11c\ubc84\uac1c\ubc1c\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/38376\/\",\"url\":\"https:\/\/atmokpo.com\/w\/38376\/\",\"name\":\"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1) - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T17:18:01+00:00\",\"dateModified\":\"2024-11-26T06:44:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/38376\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/38376\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/38376\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1) - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/38376\/","og_locale":"ko_KR","og_type":"article","og_title":"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1) - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"\uc774\ubc88 \uac15\uc88c\uc5d0\uc11c\ub294 Node.js\uc758 \uc720\uba85\ud55c \uc6f9 \ud504\ub808\uc784\uc6cc\ud06c\uc778 Express\ub97c \uc0ac\uc6a9\ud558\uc5ec \uae30\ubcf8\uc801\uc778 \ubbf8\ub4e4\uc6e8\uc5b4\ub97c \ud65c\uc6a9\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uaca0\uc2b5\ub2c8\ub2e4. Express\ub294 RESTful API \uc11c\ubc84 \ubc0f \uc6f9 \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uad6c\ucd95\ud558\ub294 \ub370 \ub9e4\uc6b0 \uc801\ud569\ud55c \ud504\ub808\uc784\uc6cc\ud06c\uc774\uba70, \uac15\ub825\ud55c \ubbf8\ub4e4\uc6e8\uc5b4 \uc2dc\uc2a4\ud15c\uc744 \uac16\ucd94\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc694\uccad\uacfc \uc751\ub2f5 \uac1d\uccb4\ub97c \ucc98\ub9ac\ud558\ub294 \ud568\uc218\ub85c, \ub2e4\uc591\ud55c \uae30\ub2a5\ub4e4\uc744 \uc81c\uacf5\ud574 \uc90d\ub2c8\ub2e4. 1. \ubbf8\ub4e4\uc6e8\uc5b4\ub780? \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc694\uccad(request)\uacfc \uc11c\ubc84\uc758 \uc751\ub2f5(response) \uc0ac\uc774\uc5d0\uc11c \uc911\uac1c \uc5ed\ud560\uc744 \uc218\ud589\ud558\ub294 \ud568\uc218\uc785\ub2c8\ub2e4. \ubbf8\ub4e4\uc6e8\uc5b4\ub294 \uc5ec\ub7ec \uac00\uc9c0 &hellip; \ub354 \ubcf4\uae30 \"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)\"","og_url":"https:\/\/atmokpo.com\/w\/38376\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T17:18:01+00:00","article_modified_time":"2024-11-26T06:44:29+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"2\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/38376\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/38376\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)","datePublished":"2024-11-01T17:18:01+00:00","dateModified":"2024-11-26T06:44:29+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/38376\/"},"wordCount":41,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Express\uc11c\ubc84\uac1c\ubc1c"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/38376\/","url":"https:\/\/atmokpo.com\/w\/38376\/","name":"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1) - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T17:18:01+00:00","dateModified":"2024-11-26T06:44:29+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/38376\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/38376\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/38376\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Express \uac1c\ubc1c \uac15\uc88c, \uae30\ubcf8 \ubbf8\ub4e4\uc6e8\uc5b4 \uc0ac\uc6a9 (body-parser, cookie-parser \ub4f1)"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/38376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=38376"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/38376\/revisions"}],"predecessor-version":[{"id":38377,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/38376\/revisions\/38377"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=38376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=38376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=38376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}