{"id":1241,"date":"2022-02-25T16:06:50","date_gmt":"2022-02-25T07:06:50","guid":{"rendered":"http:\/\/mylittleforest.kr\/wordpress\/?p=1241"},"modified":"2025-01-15T11:32:59","modified_gmt":"2025-01-15T02:32:59","slug":"npm%ea%b3%bc-express-%eb%aa%a8%eb%93%88","status":"publish","type":"post","link":"http:\/\/mylittleforest.kr\/wordpress\/blog\/2022\/02\/25\/1241\/","title":{"rendered":"npm\uacfc express \ubaa8\ub4c8"},"content":{"rendered":"\n<h2>NPM\uc73c\ub85c \ubaa8\ub4c8 \uc124\uce58<\/h2>\n\n\n\n<h3>NPM<\/h3>\n\n\n\n<ul><li>NodeJS \ubaa8\ub4c8\uc744 \uacf5\uc720\ud558\uace0 \ub2e4\uc6b4\ubc1b\ub294 \uc800\uc7a5\uc18c<\/li><li>CLI (\uba85\ub839\uc904 \uc778\ud130\ud398\uc774\uc2a4)\ub85c \uac04\ud3b8\ud558\uac8c \ubaa8\ub4c8 \uad00\ub9ac<\/li><li>\uc758\uc874\uc131 \uad00\ub9ac<ul><li>A \ubaa8\ub4c8\uc774 B \ubaa8\ub4c8\uc744 \uc0ac\uc6a9\ud560 \ub54c A\ubaa8\ub4c8\uc740 B\ubaa8\ub4c8\uc5d0 \uc758\uc874\uc131\uc774 \uc788\ub2e4\uace0 \ub9d0\ud568<\/li><li>package.json \ud30c\uc77c\ub85c \ud504\ub85c\uc81d\ud2b8 \uc758\uc874\uc131 \uad00\ub9ac<\/li><\/ul><\/li><\/ul>\n\n\n\n<h3>npm init \uba85\ub839\uc5b4<\/h3>\n\n\n\n<ul><li>NodeJS \ud504\ub85c\uc81d\ud2b8\ub97c \uc2dc\uc791\ud558\uae30 \uc704\ud55c \uba85\ub839\uc5b4<\/li><li>package.json \ud30c\uc77c\uc744 \uc0dd\uc131<\/li><li>\ud504\ub85c\uc81d\ud2b8\uc758 \uc774\ub984, \ubc84\uc804, \uac1c\ubc1c\uc790 \uc815\ubcf4 \ub4f1\uc758 \uba54\ud0c0\ub370\uc774\ud130<\/li><li>NPM\ubaa8\ub4c8\uc758 \uc758\uc874\uc131 \uc815\ubcf4 \ub4f1\uc744 \ub2f4\uace0 \uc788\uc74c<\/li><li>\uc0c8\ub85c\uc6b4 \ud3f4\ub354 \uc0dd\uc131 \ubc0f \uc2e4\ud589<ul><li>my_module_test&gt;npm init<\/li><\/ul><\/li><li>package.json<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n{\n  &quot;name&quot;: &quot;my_module_test&quot;,\n  &quot;version&quot;: &quot;1.0.0&quot;,\n  &quot;description&quot;: &quot;\ub098\uc758 \ubaa8\ub4c8 \uc2dc\ud5d8&quot;,\n  &quot;main&quot;: &quot;index.js&quot;,\n  &quot;scripts&quot;: {\n    &quot;start&quot;: &quot;node index.js&quot;\n  },\n  &quot;author&quot;: &quot;&quot;,\n  &quot;license&quot;: &quot;ISC&quot;\n}\n<\/pre><\/div>\n\n\n<ul><li>\uc5d4\ud2b8\ub9ac \ud3ec\uc778\ud2b8 : &#8220;main&#8221;: &#8220;index.js&#8221;, <\/li><li>&#8220;scripts&#8221;: {<br>&#8220;start&#8221;: &#8220;node index.js&#8221;<br>},<br>=&gt; npm run start \uba85\ub839\uc73c\ub85c \uc2e4\ud589<\/li><\/ul>\n\n\n\n<h2>Express.js \ubaa8\ub4c8 \uc0ac\uc6a9<\/h2>\n\n\n\n<h3>NPM \ud328\ud0a4\uc9c0 \uac80\uc0c9<\/h3>\n\n\n\n<ul><li><a href=\"https:\/\/www.npmjs.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.npmjs.com\/<\/a><\/li><li>express<\/li><li>&gt; npm install &#8211;save express<ul><li>package.json \uc5d0 \uc758\uc874\uc131 \uc815\ubcf4\ub97c \uc800\uc7a5\ud558\ub824\uba74 &#8211;save \uc635\uc158\uacfc \ud568\uaed8 \uc2e4\ud589<\/li><li>express\uc5d0 \uc758\uc874\uc131 \uc788\ub294 \ubaa8\ub4e0 \ubaa8\ub4c8 \uc124\uce58\ub428<\/li><\/ul><\/li><\/ul>\n\n\n\n<h3><a href=\"http:\/\/expressjs.com\/en\/4x\/api.html\" target=\"_blank\" rel=\"noreferrer noopener\">Express<\/a><\/h3>\n\n\n\n<ul><li>\uace0\uc131\ub2a5 \uc6f9 \ud504\ub808\uc784\uc6cc\ud06c<\/li><li>\ud504\ub85c\uadf8\ub798\uba38\uac00 \uc791\uc131\ud55c \ud568\uc218\ub97c \uc2e4\ud589\ud574 HTTP\uc694\uccad\uc5d0 \ub300\ud55c HTTP\uc751\ub2f5\uc744 \ud504\ub85c\uadf8\ub798\uba38\uac00 \uc6d0\ud558\ub294 \ub300\ub85c \ub9cc\ub4e4\uc5b4 HTTP\ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0\uac8c \uc751\ub2f5\ud560 \uc218 \uc788\uc74c<\/li><li>\uc694\uccad\ud55c URL\uc774\ub098 HTTP\uba54\uc11c\ub4dc\uc5d0 \ub530\ub77c \uc6d0\ud558\ub294 \ud568\uc218\ub97c \uc2e4\ud589\uc2dc\ucf1c \uc8fc\ub294 \ub77c\uc6b0\ud305 \uae30\ub2a5<\/li><li>HTML\uc758 \ub0b4\uc6a9 \uc77c\ubd80\ubd84\uc744 \ubcc0\uc218\uc5d0 \uc800\uc7a5\ub41c \uac12\uc73c\ub85c \uce58\ud658\ud574 \ub3d9\uc801\uc778 HTML\uc744 \ub9cc\ub4e4\uc5b4 \uc751\ub2f5\ud558\ub294 \ubdf0 \ud15c\ud50c\ub9bf \uc5d4\uc9c4\ub3c4 \uac00\uc9c0\uace0 \uc788\ub2e4<\/li><li>\ubbf8\ub4e4\uc6e8\uc5b4\ub85c \uae30\ub2a5 \ud655\uc7a5<\/li><\/ul>\n\n\n\n<h3>require \ud568\uc218\ub85c \uc678\ubd80 \ubaa8\ub4c8 \uc774\uc6a9\ud558\uae30<\/h3>\n\n\n\n<ul><li>require \ud568\uc218 \ubaa8\ub4c8\uba85\uc744 \uc778\uc790\ub85c \uc2e4\ud589<\/li><li>\ud30c\uc77c\uba85\uc744 \uc804\ub2ec\ud560 \ub54c\uc640 \ub9c8\ucc2c\uac00\uc9c0\ub85c \ud574\ub2f9 \ubaa8\ub4c8\uc744 \ubc18\ud658<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar express = require('express');\nvar app = express();\n\napp.listen(3000, function() {\n    console.log(&quot;3000 \ud3ec\ud2b8\ub85c \uc6f9\uc11c\ubc84 \uc2e4\ud589!&quot;);\n});\n<\/pre><\/div>\n\n\n<ul><li>my_module_test&gt; npm run start<\/li><li>ctrl + C \ud0a4\ub85c \uc885\ub8cc<\/li><\/ul>\n\n\n\n<h3>\ubbf8\ub4e4\uc6e8\uc5b4 \ucf5c\ubc31\ud568\uc218\uc758 \uc778\uc218<\/h3>\n\n\n\n<ul><li>HTTP \uc694\uccad -&gt; \ubbf8\ub4e4\uc6e8\uc5b41 -&gt; \ubbf8\ub4e4\uc6e8\uc5b42 -&gt; \ubbf8\ub4e4\uc6e8\uc5b4&#8230; -&gt; HTTP \uc751\ub2f5<\/li><li>Request \uac1d\uccb4<ul><li>HTTP\uc694\uccad\uc5d0 \ub300\ud55c \uc815\ubcf4\uac00 \ub2f4\uaca8 \uc788\uc74c<\/li><\/ul><\/li><li>Response \uac1d\uccb4<ul><li>\ube0c\ub77c\uc6b0\uc800\uc5d0 \uc804\uc1a1\ud560 HTTP\uc751\ub2f5\uc744 \uc5b4\ub5bb\uac8c \ub9cc\ub4e4\uc9c0\uc5d0 \ub300\ud55c \uc815\ubcf4\ub97c \uc124\uc815<\/li><\/ul><\/li><li>next \ud568\uc218<ul><li>\uc774\uc804 \ubbf8\ub4e4\uc6e8\uc5b4\uc5d0\uc11c \ub2e4\uc74c \ubbf8\ub4e4\uc6e8\uc5b4\ub3c4 \uc2e4\ud589\ud574\uc57c \ud55c\ub2e4\uace0 \uc54c\ub824\uc8fc\ub294 \ud568\uc218<\/li><\/ul><\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\napp.use(function(req, res, next) {\n    res.send('OK');\n})\n<\/pre><\/div>\n\n\n<ul><li>\ub514\ubc84\uae45<ul><li>JavaScript Debug Terminal \ub85c \uc2e4\ud589<\/li><li>\ub514\ubc84\uadf8 \ud130\ubbf8\ub110\uc5d0\uc11c my_module_test&gt; npm run start \uc218\ud589<\/li><li>break point<\/li><\/ul><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>NPM\uc73c\ub85c \ubaa8\ub4c8 \uc124\uce58 NPM NodeJS \ubaa8\ub4c8\uc744 \uacf5\uc720\ud558\uace0 \ub2e4\uc6b4\ubc1b\ub294 \uc800\uc7a5\uc18c CLI (\uba85\ub839\uc904 \uc778\ud130\ud398\uc774\uc2a4)\ub85c \uac04\ud3b8\ud558\uac8c \ubaa8\ub4c8 \uad00\ub9ac \uc758\uc874\uc131 \uad00\ub9ac A \ubaa8\ub4c8\uc774 B \ubaa8\ub4c8\uc744 \uc0ac\uc6a9\ud560 \ub54c A\ubaa8\ub4c8\uc740 B\ubaa8\ub4c8\uc5d0 \uc758\uc874\uc131\uc774 \uc788\ub2e4\uace0 \ub9d0\ud568 package.json \ud30c\uc77c\ub85c \ud504\ub85c\uc81d\ud2b8 \uc758\uc874\uc131 \uad00\ub9ac npm init \uba85\ub839\uc5b4 NodeJS \ud504\ub85c\uc81d\ud2b8\ub97c \uc2dc\uc791\ud558\uae30 \uc704\ud55c \uba85\ub839\uc5b4 package.json \ud30c\uc77c\uc744 \uc0dd\uc131 \ud504\ub85c\uc81d\ud2b8\uc758 \uc774\ub984, \ubc84\uc804, \uac1c\ubc1c\uc790 \uc815\ubcf4 \ub4f1\uc758 \uba54\ud0c0\ub370\uc774\ud130 NPM\ubaa8\ub4c8\uc758 \uc758\uc874\uc131 \uc815\ubcf4 \ub4f1\uc744 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[38,37],"tags":[],"_links":{"self":[{"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/posts\/1241"}],"collection":[{"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/comments?post=1241"}],"version-history":[{"count":11,"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/posts\/1241\/revisions"}],"predecessor-version":[{"id":1338,"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/posts\/1241\/revisions\/1338"}],"wp:attachment":[{"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/media?parent=1241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/categories?post=1241"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mylittleforest.kr\/wordpress\/wp-json\/wp\/v2\/tags?post=1241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}