diff options
Diffstat (limited to 'files/ko/learn/server-side/express_nodejs/개발_환경/index.html')
-rw-r--r-- | files/ko/learn/server-side/express_nodejs/개발_환경/index.html | 76 |
1 files changed, 36 insertions, 40 deletions
diff --git a/files/ko/learn/server-side/express_nodejs/개발_환경/index.html b/files/ko/learn/server-side/express_nodejs/개발_환경/index.html index b8c8db8ffa..f3ab1846f6 100644 --- a/files/ko/learn/server-side/express_nodejs/개발_환경/index.html +++ b/files/ko/learn/server-side/express_nodejs/개발_환경/index.html @@ -35,11 +35,11 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment <h2 id="Express_개발_환경_개요">Express 개발 환경 개요</h2> -<p><em>Node</em> and <em>Express</em> make it very easy to set up your computer in order to start developing web applications. This section provides an overview of what tools are needed, explains some of the simplest methods for installing Node (and Express) on Ubuntu, macOS, and Windows, and shows how you can test your installation.</p> +<p>Node와 Express를 통해 웹앱 개발을 한결 수월하게 할 수 있습니다. 이 섹션에서는 어떤 도구들이 필요한지, Ubuntu, macOS, 그리고 Windows에서 어떻게 Node와 Express를 설치하는지, 마지막으로, 설치 후 어떻게 테스트해볼 수 있는지 살펴볼 것입니다.</p> <h3 id="Express_개발_환경이란_무엇입니까">Express 개발 환경이란 무엇입니까?</h3> -<p>The <em>Express</em> development environment includes an installation of <em>Nodejs</em>, the <em>NPM package manager</em>, and (optionally) the <em>Express Application Generator</em> on your local computer.</p> +<p>Express개발환경은 Nodejs의 설치, NPM 패키지 매니저, 그리고 (선택적) 로컬 컴퓨터의 <em>Express Application Generator</em>를<em> </em>포함합니다.</p> <p><em>Node</em> and the <em>NPM</em> package manager are installed together from prepared binary packages, installers, operating system package managers or from source (as shown in the following sections). <em>Express</em> is then installed by NPM as a dependency of your individual <em>Express</em> web applications (along with other libraries like template engines, database drivers, authentication middleware, middleware to serve static files, etc.)</p> @@ -55,7 +55,7 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment <p><em>Node</em> can be run on Windows, macOS, many "flavours" of Linux, Docker, etc. (there is a full list on the nodejs <a href="https://nodejs.org/en/download/">Downloads</a> page). Almost any personal computer should have the necessary performance to run Node during development. <em>Express</em> is run in a <em>Node</em> environment, and hence can run on any platform that runs <em>Node</em>.</p> -<p>In this article we provide setup instructions for Windows, macOS, and Ubuntu Linux.</p> +<p>이 기사에서는 Windows, macOS, 그리고 Ubuntu Linux에서의 설치방법을 안내해드리고 있습니다.</p> <h3 id="What_version_of_NodeExpress_should_you_use">What version of Node/Express should you use?</h3> @@ -71,7 +71,7 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment <h2 id="Node_설치하기">Node 설치하기</h2> -<p>In order to use <em>Express</em> you will first have to install <em>Nodejs</em> and the <a href="https://docs.npmjs.com/">Node Package Manager (NPM)</a> on your operating system. The following sections explain the easiest way to install the Long Term Supported (LTS) version of Nodejs on Ubuntu Linux 16.04, macOS, and Windows 10.</p> +<p><em>Express</em> 를 사용하기 위해서 우선 운영체제에 <em>Nodejs</em>와 <a href="https://docs.npmjs.com/">Node Package Manager (NPM)</a>를 설치해야 합니다. The following sections explain the easiest way to install the Long Term Supported (LTS) version of Nodejs on Ubuntu Linux 16.04, macOS, and Windows 10.</p> <div class="note"> <p><strong>Tip:</strong> The sections below show the easiest way to install <em>Node</em> and <em>NPM</em> on our target OS platforms. If you're using another OS or just want to see some of the other approaches for the current platforms then see <a href="https://nodejs.org/en/download/package-manager/">Installing Node.js via package manager</a> (nodejs.org).</p> @@ -79,23 +79,21 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment <h3 id="Windows_and_macOS">Windows and macOS</h3> -<p>Installing <em>Node</em> and <em>NPM</em> on Windows and macOS is straightforward because you can just use the provided installer:</p> +<p><em>Node</em>와 <em>NPM</em>을 설치하는 것은 간단합니다:</p> <ol> - <li>Download the required installer: + <li>Installer를 다운받읍시다: <ol> - <li>Go to <a href="https://nodejs.org/en/">https://nodejs.org/en/</a></li> - <li>Select the button to download the LTS build that is "Recommended for most users".</li> + <li><a href="https://nodejs.org/en/">https://nodejs.org/en/</a></li> + <li>"안정적이고 신뢰도가 높은" LTS버튼을 클릭해 다운로드를 시작합니다. .</li> </ol> </li> - <li>Install Node by double-clicking on the downloaded file and following the installation prompts.</li> + <li>다운로드된 파일을 더블클릭해 Node를 설치합니다.</li> </ol> -<h3 id="Ubuntu_18.04">Ubuntu 18.04</h3> - <p>The easiest way to install the most recent LTS version of Node 10.x is to use the <a href="https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions">package manager</a> to get it from the Ubuntu <em>binary distributions</em> repository. This can be done very simply by running the following two commands on your terminal:</p> -<pre class="brush: bash">curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - +<pre class="brush: bash notranslate">curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt-get install -y nodejs </pre> @@ -106,16 +104,16 @@ sudo apt-get install -y nodejs <ol> </ol> -<h3 id="Testing_your_Nodejs_and_NPM_installation">Testing your Nodejs and NPM installation</h3> +<h3 id="Nodejs와_NPM_테스팅">Nodejs와 NPM 테스팅</h3> <p>The easiest way to test that node is installed is to run the "version" command in your terminal/command prompt and check that a version string is returned:</p> -<pre class="brush: bash">>node -v +<pre class="brush: bash notranslate">>node -v v10.15.1</pre> <p>The <em>Nodejs</em> package manager <em>NPM</em> should also have been installed, and can be tested in the same way:</p> -<pre class="brush: bash">>npm -v +<pre class="brush: bash notranslate">>npm -v 6.4.1</pre> <p>As a slightly more exciting test let's create a very basic "pure node" server that simply prints out "Hello World" in the browser when you visit the correct URL in your browser:</p> @@ -123,7 +121,7 @@ v10.15.1</pre> <ol> <li>Copy the following text into a file named <strong>hellonode.js</strong>. This uses pure <em>Node</em> features (nothing from Express) and some ES6 syntax: - <pre class="brush: js">//Load HTTP module + <pre class="brush: js notranslate">//Load HTTP module const http = require("http"); const hostname = '127.0.0.1'; const port = 3000; @@ -150,7 +148,7 @@ server.listen(port, hostname, () => { </div> </li> <li>Start the server by navigating into the same directory as your <code>hellonode.js</code> file in your command prompt, and calling <code>node</code> along with the script name, like so: - <pre class="brush: bash">>node hellonode.js + <pre class="brush: bash notranslate">>node hellonode.js Server running at http://127.0.0.1:3000/ </pre> </li> @@ -167,7 +165,7 @@ Server running at http://127.0.0.1:3000/ <p>You can manually use NPM to separately fetch each needed package. Typically we instead manage dependencies using a plain-text definition file named <a href="https://docs.npmjs.com/files/package.json">package.json</a>. This file lists all the dependencies for a specific JavaScript "package", including the package's name, version, description, initial file to execute, production dependencies, development dependencies, versions of <em>Node</em> it can work with, etc. The <strong>package.json</strong> file should contain everything NPM needs to fetch and run your application (if you were writing a reusable library you could use this definition to upload your package to the npm respository and make it available for other users).</p> -<h3 id="Adding_dependencies">Adding dependencies</h3> +<h3 id="dependencies_추가">dependencies 추가</h3> <p>The following steps show how you can use NPM to download a package, save it into the project dependencies, and then require it in a Node application.</p> @@ -177,15 +175,15 @@ Server running at http://127.0.0.1:3000/ <ol> <li>First create a directory for your new application and navigate into it: - <pre class="brush: bash">mkdir myapp + <pre class="brush: bash notranslate">mkdir myapp cd myapp</pre> </li> <li>Use the npm <code>init</code> command to create a <strong>package.json</strong> file for your application. This command prompts you for a number of things, including the name and version of your application and the name of the initial entry point file (by default this is <strong>index.js</strong>). For now, just accept the defaults: - <pre class="brush: bash">npm init</pre> + <pre class="brush: bash notranslate">npm init</pre> <p>If you display the <strong>package.json</strong> file (<code>cat package.json</code>), you will see the defaults that you accepted, ending with the license.</p> - <pre class="brush: json">{ + <pre class="brush: json notranslate">{ "name": "myapp", "version": "1.0.0", "description": "", @@ -200,11 +198,11 @@ cd myapp</pre> </li> <li>Now install Express in the <code>myapp</code> directory and save it in the dependencies list of your <strong>package.json</strong> file</li> <li> - <pre class="brush: bash">npm install express</pre> + <pre class="brush: bash notranslate">npm install express</pre> <p>The dependencies section of your <strong>package.json</strong> will now appear at the end of the <strong>package.json</strong> file and will include <em>Express</em>.</p> - <pre class="brush: json">{ + <pre class="brush: json notranslate">{ "name": "myapp", "version": "1.0.0", "description": "", @@ -221,7 +219,7 @@ cd myapp</pre> </pre> </li> <li>To use the Express library you call the <code>require()</code> function in your index.js file to include it in your application. Create this file now, in the root of the "myapp" application directory, and give it the following contents: - <pre class="brush: js">const express = require('express') + <pre class="brush: js notranslate">const express = require('express') const app = express(); app.get('/', (req, res) => { @@ -236,7 +234,7 @@ app.listen(8000, () => { <p>This code shows a minimal "HelloWorld" Express web application. This imports the "express" module using <code>require()</code> and uses it to create a server (<code>app</code>) that listens for HTTP requests on port 8000 and prints a message to the console explaining what browser URL you can use to test the server. The <code>app.get()</code> function only responds to HTTP <code>GET</code> requests with the specified URL path ('/'), in this case by calling a function to send our <em>Hello World!</em> message.</p> </li> <li>You can start the server by calling node with the script in your command prompt: - <pre class="brush: bash">>node index.js + <pre class="brush: bash notranslate">>node index.js Example app listening on port 8000 </pre> </li> @@ -247,11 +245,11 @@ Example app listening on port 8000 <p>If a dependency is only used during development, you should instead save it as a "development dependency" (so that your package users don't have to install it in production). For example, to use the popular JavaScript Linting tool <a href="http://eslint.org/">eslint</a> you would call NPM as shown:</p> -<pre class="brush: bash"><code>npm install eslint --save-dev</code></pre> +<pre class="brush: bash notranslate"><code>npm install eslint --save-dev</code></pre> <p>The following entry would then be added to your application's <strong>package.json</strong>:</p> -<pre class="brush: js"> "devDependencies": { +<pre class="brush: js notranslate"> "devDependencies": { "eslint": "^4.12.1" } </pre> @@ -270,7 +268,7 @@ Example app listening on port 8000 <p>For example, to define a script to run the <em>eslint</em> development dependency that we specified in the previous section we might add the following script block to our <strong>package.json</strong> file (assuming that our application source is in a folder /src/js):</p> -<pre class="brush: js">"scripts": { +<pre class="brush: js notranslate">"scripts": { ... "lint": "eslint src/js" ... @@ -281,7 +279,7 @@ Example app listening on port 8000 <p>We would then be able to run <em>eslint</em> using NPM by calling:</p> -<pre class="brush: bash"><code>npm run-script lint +<pre class="brush: bash notranslate"><code>npm run-script lint # OR (using the alias) npm run lint</code> </pre> @@ -292,16 +290,16 @@ npm run lint</code> <p>The <a href="https://expressjs.com/en/starter/generator.html">Express Application Generator</a> tool generates an Express application "skeleton". Install the generator using NPM as shown (the <code>-g</code> flag installs the tool globally so that you can call it from anywhere):</p> -<pre><code>npm install express-generator -g</code></pre> +<pre class="notranslate"><code>npm install express-generator -g</code></pre> <p>To create an <em>Express</em> app named "helloworld" with the default settings, navigate to where you want to create it and run the app as shown:</p> -<pre class="brush: bash">express helloworld</pre> +<pre class="brush: bash notranslate">express helloworld</pre> <div class="note"> <p><strong>Note: </strong>You can also specify the template library to use and a number of other settings. Use the <code>help</code> command to see all the options:</p> -<pre class="brush: bash">express --help +<pre class="brush: bash notranslate">express --help </pre> </div> @@ -310,7 +308,7 @@ npm run lint</code> <div class="note"> <p>The new app will have a <strong>package.json</strong> file in its root directory. You can open this to see what dependencies are installed, including Express and the template library Jade:</p> -<pre class="brush: js">{ +<pre class="brush: js notranslate">{ "name": "helloworld", "version": "0.0.0", "private": true, @@ -328,18 +326,18 @@ npm run lint</code> } </pre> -<p> </p> + </div> <p>Install all the dependencies for the helloworld app using NPM as shown:</p> -<pre class="brush: bash">cd helloworld +<pre class="brush: bash notranslate">cd helloworld npm install </pre> <p>Then run the app (the commands are slightly different for Windows and Linux/macOS), as shown below:</p> -<pre class="brush: bash"># Run the helloworld on Windows with Command Prompt +<pre class="brush: bash notranslate"># Run the helloworld on Windows with Command Prompt SET DEBUG=helloworld:* & npm start # Run the helloworld on Windows with PowerShell @@ -351,7 +349,7 @@ DEBUG=helloworld:* npm start <p>The DEBUG command creates useful logging, resulting in an output like that shown below.</p> -<pre class="brush: bash">>SET DEBUG=helloworld:* & npm start +<pre class="brush: bash notranslate">>SET DEBUG=helloworld:* & npm start > helloworld@0.0.0 start D:\Github\expresstests\helloworld > node ./bin/www @@ -384,7 +382,7 @@ DEBUG=helloworld:* npm start <p>{{PreviousMenuNext("Learn/Server-side/Express_Nodejs/Introduction", "Learn/Server-side/Express_Nodejs/Tutorial_local_library_website", "Learn/Server-side/Express_Nodejs")}}</p> -<p> </p> + <h2 id="In_this_module">In this module</h2> @@ -399,5 +397,3 @@ DEBUG=helloworld:* npm start <li><a href="/en-US/docs/Learn/Server-side/Express_Nodejs/forms">Express Tutorial Part 6: Working with forms</a></li> <li><a href="/en-US/docs/Learn/Server-side/Express_Nodejs/deployment">Express Tutorial Part 7: Deploying to production</a></li> </ul> - -<p> </p> |