From 869dd2069c695ee7040cd3261713212155819f42 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 14 Dec 2020 12:18:12 -0500 Subject: final dump 2020-12-14 --- .../index.html" | 76 ++++++++++------------ 1 file changed, 36 insertions(+), 40 deletions(-) (limited to 'files/ko/learn/server-side/express_nodejs') diff --git "a/files/ko/learn/server-side/express_nodejs/\352\260\234\353\260\234_\355\231\230\352\262\275/index.html" "b/files/ko/learn/server-side/express_nodejs/\352\260\234\353\260\234_\355\231\230\352\262\275/index.html" index b8c8db8ffa..f3ab1846f6 100644 --- "a/files/ko/learn/server-side/express_nodejs/\352\260\234\353\260\234_\355\231\230\352\262\275/index.html" +++ "b/files/ko/learn/server-side/express_nodejs/\352\260\234\353\260\234_\355\231\230\352\262\275/index.html" @@ -35,11 +35,11 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment

Express 개발 환경 개요

-

Node and Express 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.

+

Node와 Express를 통해 웹앱 개발을 한결 수월하게 할 수 있습니다. 이 섹션에서는 어떤 도구들이 필요한지, Ubuntu, macOS, 그리고 Windows에서 어떻게 Node와 Express를 설치하는지, 마지막으로, 설치 후 어떻게 테스트해볼 수 있는지 살펴볼 것입니다.

Express 개발 환경이란 무엇입니까?

-

The Express development environment includes an installation of Nodejs, the NPM package manager, and (optionally) the Express Application Generator on your local computer.

+

Express개발환경은 Nodejs의 설치, NPM 패키지 매니저, 그리고 (선택적) 로컬 컴퓨터의 Express Application Generator 포함합니다.

Node and the NPM package manager are installed together from prepared binary packages, installers, operating system package managers or from source (as shown in the following sections). Express is then installed by NPM as a dependency of your individual Express web applications (along with other libraries like template engines, database drivers, authentication middleware, middleware to serve static files, etc.)

@@ -55,7 +55,7 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment

Node can be run on Windows, macOS, many "flavours" of Linux, Docker, etc. (there is a full list on the nodejs Downloads page). Almost any personal computer should have the necessary performance to run Node during development. Express is run in a Node environment, and hence can run on any platform that runs Node.

-

In this article we provide setup instructions for Windows, macOS, and Ubuntu Linux.

+

이 기사에서는 Windows, macOS, 그리고 Ubuntu Linux에서의 설치방법을 안내해드리고 있습니다.

What version of Node/Express should you use?

@@ -71,7 +71,7 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment

Node 설치하기

-

In order to use Express you will first have to install Nodejs and the Node Package Manager (NPM) 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.

+

Express 를 사용하기 위해서 우선 운영체제에 Nodejs와 Node Package Manager (NPM)를 설치해야 합니다. 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.

Tip: The sections below show the easiest way to install Node and NPM 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 Installing Node.js via package manager (nodejs.org).

@@ -79,23 +79,21 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment

Windows and macOS

-

Installing Node and NPM on Windows and macOS is straightforward because you can just use the provided installer:

+

Node와 NPM을 설치하는 것은 간단합니다:

    -
  1. Download the required installer: +
  2. Installer를 다운받읍시다:
      -
    1. Go to https://nodejs.org/en/
    2. -
    3. Select the button to download the LTS build that is "Recommended for most users".
    4. +
    5. https://nodejs.org/en/
    6. +
    7. "안정적이고 신뢰도가 높은" LTS버튼을 클릭해 다운로드를 시작합니다. .
  3. -
  4. Install Node by double-clicking on the downloaded file and following the installation prompts.
  5. +
  6. 다운로드된 파일을 더블클릭해 Node를 설치합니다.
-

Ubuntu 18.04

-

The easiest way to install the most recent LTS version of Node 10.x is to use the package manager to get it from the Ubuntu binary distributions repository. This can be done very simply by running the following two commands on your terminal:

-
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
+
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
 sudo apt-get install -y nodejs
 
@@ -106,16 +104,16 @@ sudo apt-get install -y nodejs
-

Testing your Nodejs and NPM installation

+

Nodejs와 NPM 테스팅

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:

-
>node -v
+
>node -v
 v10.15.1

The Nodejs package manager NPM should also have been installed, and can be tested in the same way:

-
>npm -v
+
>npm -v
 6.4.1

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:

@@ -123,7 +121,7 @@ v10.15.1
  1. Copy the following text into a file named hellonode.js. This uses pure Node features (nothing from Express) and some ES6 syntax: -
    //Load HTTP module
    +  
    //Load HTTP module
     const http = require("http");
     const hostname = '127.0.0.1';
     const port = 3000;
    @@ -150,7 +148,7 @@ server.listen(port, hostname, () => {
       
  • Start the server by navigating into the same directory as your hellonode.js file in your command prompt, and calling node along with the script name, like so: -
    >node hellonode.js
    +  
    >node hellonode.js
     Server running at http://127.0.0.1:3000/
     
  • @@ -167,7 +165,7 @@ Server running at http://127.0.0.1:3000/

    You can manually use NPM to separately fetch each needed package. Typically we instead manage dependencies using a plain-text definition file named package.json. 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 Node it can work with, etc. The package.json 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).

    -

    Adding dependencies

    +

    dependencies 추가

    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.

    @@ -177,15 +175,15 @@ Server running at http://127.0.0.1:3000/
    1. First create a directory for your new application and navigate into it: -
      mkdir myapp
      +  
      mkdir myapp
       cd myapp
    2. Use the npm init command to create a package.json 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 index.js). For now, just accept the defaults: -
      npm init
      +
      npm init

      If you display the package.json file (cat package.json), you will see the defaults that you accepted, ending with the license.

      -
      {
      +  
      {
         "name": "myapp",
         "version": "1.0.0",
         "description": "",
      @@ -200,11 +198,11 @@ cd myapp
    3. Now install Express in the myapp directory and save it in the dependencies list of your package.json file
    4. -
      npm install express
      +
      npm install express

      The dependencies section of your package.json will now appear at the end of the package.json file and will include Express.

      -
      {
      +  
      {
         "name": "myapp",
         "version": "1.0.0",
         "description": "",
      @@ -221,7 +219,7 @@ cd myapp
    5. To use the Express library you call the require() 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: -
      const express = require('express')
      +  
      const express = require('express')
       const app = express();
       
       app.get('/', (req, res) => {
      @@ -236,7 +234,7 @@ app.listen(8000, () => {
         

      This code shows a minimal "HelloWorld" Express web application. This imports the "express" module using require() and uses it to create a server (app) 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 app.get() function only responds to HTTP GET requests with the specified URL path ('/'), in this case by calling a function to send our Hello World! message.

    6. You can start the server by calling node with the script in your command prompt: -
      >node index.js
      +  
      >node index.js
       Example app listening on port 8000
       
    7. @@ -247,11 +245,11 @@ Example app listening on port 8000

      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 eslint you would call NPM as shown:

      -
      npm install eslint --save-dev
      +
      npm install eslint --save-dev

      The following entry would then be added to your application's package.json:

      -
        "devDependencies": {
      +
        "devDependencies": {
           "eslint": "^4.12.1"
         }
       
      @@ -270,7 +268,7 @@ Example app listening on port 8000

      For example, to define a script to run the eslint development dependency that we specified in the previous section we might add the following script block to our package.json file (assuming that our application source is in a folder /src/js):

      -
      "scripts": {
      +
      "scripts": {
         ...
         "lint": "eslint src/js"
         ...
      @@ -281,7 +279,7 @@ Example app listening on port 8000
       
       

      We would then be able to run eslint using NPM by calling:

      -
      npm run-script lint
      +
      npm run-script lint
       # OR (using the alias)
       npm run lint
       
      @@ -292,16 +290,16 @@ npm run lint

      The Express Application Generator tool generates an Express application "skeleton". Install the generator using NPM as shown (the -g flag installs the tool globally so that you can call it from anywhere):

      -
      npm install express-generator -g
      +
      npm install express-generator -g

      To create an Express app named "helloworld" with the default settings, navigate to where you want to create it and run the app as shown:

      -
      express helloworld
      +
      express helloworld

      Note: You can also specify the template library to use and a number of other settings. Use the help command to see all the options:

      -
      express --help
      +
      express --help
       
      @@ -310,7 +308,7 @@ npm run lint

      The new app will have a package.json file in its root directory. You can open this to see what dependencies are installed, including Express and the template library Jade:

      -
      {
      +
      {
         "name": "helloworld",
         "version": "0.0.0",
         "private": true,
      @@ -328,18 +326,18 @@ npm run lint
       }
       
      -

       

      +

      Install all the dependencies for the helloworld app using NPM as shown:

      -
      cd helloworld
      +
      cd helloworld
       npm install
       

      Then run the app (the commands are slightly different for Windows and Linux/macOS), as shown below:

      -
      # Run the helloworld on Windows with Command Prompt
      +
      # 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
       
       

      The DEBUG command creates useful logging, resulting in an output like that shown below.

      -
      >SET DEBUG=helloworld:* & npm start
      +
      >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
       
       

      {{PreviousMenuNext("Learn/Server-side/Express_Nodejs/Introduction", "Learn/Server-side/Express_Nodejs/Tutorial_local_library_website", "Learn/Server-side/Express_Nodejs")}}

      -

       

      +

      In this module

      @@ -399,5 +397,3 @@ DEBUG=helloworld:* npm start
    8. Express Tutorial Part 6: Working with forms
    9. Express Tutorial Part 7: Deploying to production
    10. - -

       

      -- cgit v1.2.3-54-g00ecf