From b8899e350326af3e53dfad89747761c1c13a3915 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 14 Sep 2021 11:06:51 +0900 Subject: Learn 以下の文書内のリンクURLを正規化 (#2356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /en-US へのリンクを /ja へのリンクに修正 - /ja が付いていないものに /ja を付加 - MDN内のリンクが完全URLの場合、 /ja/docs からのURLに修正 --- .../express_nodejs/deployment/index.html | 28 +++++++++---------- .../development_environment/index.html | 20 +++++++------- .../displaying_data/author_detail_page/index.html | 4 +-- .../displaying_data/author_list_page/index.html | 8 +++--- .../displaying_data/book_detail_page/index.html | 4 +-- .../displaying_data/book_list_page/index.html | 6 ++-- .../index.html | 2 +- .../bookinstance_list_page/index.html | 4 +-- .../date_formatting_using_moment/index.html | 4 +-- .../flow_control_using_async/index.html | 4 +-- .../displaying_data/genre_detail_page/index.html | 6 ++-- .../displaying_data/home_page/index.html | 8 +++--- .../express_nodejs/displaying_data/index.html | 18 ++++++------ .../locallibrary_base_template/index.html | 6 ++-- .../displaying_data/template_primer/index.html | 8 +++--- .../server-side/express_nodejs/forms/index.html | 32 +++++++++++----------- .../ja/learn/server-side/express_nodejs/index.html | 2 +- .../express_nodejs/introduction/index.html | 2 +- .../server-side/express_nodejs/mongoose/index.html | 20 +++++++------- .../server-side/express_nodejs/routes/index.html | 28 +++++++++---------- .../express_nodejs/skeleton_website/index.html | 18 ++++++------ .../tutorial_local_library_website/index.html | 18 ++++++------ 22 files changed, 125 insertions(+), 125 deletions(-) (limited to 'files/ja/learn/server-side/express_nodejs') diff --git a/files/ja/learn/server-side/express_nodejs/deployment/index.html b/files/ja/learn/server-side/express_nodejs/deployment/index.html index 6f8b60f094..768095355b 100644 --- a/files/ja/learn/server-side/express_nodejs/deployment/index.html +++ b/files/ja/learn/server-side/express_nodejs/deployment/index.html @@ -35,7 +35,7 @@ translation_of: Learn/Server-side/Express_Nodejs/deployment

Once your site is finished (or finished "enough" to start public testing) you're going to need to host it somewhere more public and accessible than your personal development computer.

-

Up to now, you've been working in a development environment, using Express/Node as a web server to share your site to the local browser/network, and running your website with (insecure) development settings that expose debugging and other private information. Before you can host a website externally you're first going to have to:

+

Up to now, you've been working in a development environment, using Express/Node as a web server to share your site to the local browser/network, and running your website with (insecure) development settings that expose debugging and other private information. Before you can host a website externally you're first going to have to:

-

The good news when you're starting out is that there are quite a few sites that provide computing environments for "free", albeit with some conditions. For example, Heroku provides a free but resource-limited PaaS environment "forever", while Amazon Web Services, Microsoft Azure, and the open source option PWS/Cloud Foundry provide free credit when you first join.

+

The good news when you're starting out is that there are quite a few sites that provide computing environments for "free", albeit with some conditions. For example, Heroku provides a free but resource-limited PaaS environment "forever", while Amazon Web Services, Microsoft Azure, and the open source option PWS/Cloud Foundry provide free credit when you first join.

Many providers also have a "basic" tier that provides more useful levels of computing power and fewer limitations. Digital Ocean is an example of a popular hosting provider that offers a relatively inexpensive basic computing tier (in the $5 per month lower range at time of writing).

@@ -382,7 +382,7 @@ v8.9.1
npm install
 
-

Now run the site (see Testing the routes for the relevant commands) and check that the site still behaves as you expect.

+

Now run the site (see Testing the routes for the relevant commands) and check that the site still behaves as you expect.

Save changes to Github

@@ -446,7 +446,7 @@ Setting NODE_ENV and restarting limitless-tor-18923... done, v13 NODE_ENV: production -

We should also use a separate database for production, setting its URI in the MONGODB_URI  environment variable. You can set up a new database and database-user exactly as we did originally, and get its URI. You can set the URI as shown (obviously, using your own URI!)

+

We should also use a separate database for production, setting its URI in the MONGODB_URI  environment variable. You can set up a new database and database-user exactly as we did originally, and get its URI. You can set the URI as shown (obviously, using your own URI!)

>heroku config:set MONGODB_URI='mongodb://your_user:your_password@ds139278.mlab.com:39278/local_library_production'
 Setting MONGODB_URI and restarting limitless-tor-18923... done, v13
@@ -513,13 +513,13 @@ heroku ps   #Display dyno status
 

このモジュール

diff --git a/files/ja/learn/server-side/express_nodejs/development_environment/index.html b/files/ja/learn/server-side/express_nodejs/development_environment/index.html index 7bfa26bb88..47c9aa76ce 100644 --- a/files/ja/learn/server-side/express_nodejs/development_environment/index.html +++ b/files/ja/learn/server-side/express_nodejs/development_environment/index.html @@ -46,7 +46,7 @@ translation_of: Learn/Server-side/Express_Nodejs/development_environment

Node と NPM パッケージマネージャーは、準備されたバイナリパッケージ、インストーラー、オペレーティングシステムのパッケージマネージャー、またはソースから一緒にインストールされます (次のセクションを参照)。 Express は、NPM によって、個々の Express ウェブアプリケーションの依存関係として (テンプレートエンジン、データベースドライバー、認証ミドルウェア、静的ファイルを提供するためのミドルウェアなどの他のライブラリと共に) インストールされます。

-

NPMMVC パターンに従ったスケルトンの Express ウェブアプリケーションを作成するための便利なツールである Express Application Generatorを (グローバルに) インストールするためにも使用できます。Express を使用するアプリを作成したり、同じアーキテクチャ上のレイアウトや依存関係を持つ Express アプリを構築したりするためにこのツールを使用する必要はないため、アプリケーションジェネレーターはオプションです。ただし、使い始めるのがはるかに簡単になり、モジュール式のアプリケーション構造が促進されるため、これを使用します。

+

NPMMVC パターンに従ったスケルトンの Express ウェブアプリケーションを作成するための便利なツールである Express Application Generatorを (グローバルに) インストールするためにも使用できます。Express を使用するアプリを作成したり、同じアーキテクチャ上のレイアウトや依存関係を持つ Express アプリを構築したりするためにこのツールを使用する必要はないため、アプリケーションジェネレーターはオプションです。ただし、使い始めるのがはるかに簡単になり、モジュール式のアプリケーション構造が促進されるため、これを使用します。

メモ: 他のウェブフレームワークとは異なり、開発環境には独立した開発用の ウェブサーバーは含まれていません。Node/Express では、ウェブアプリケーションが独自のウェブサーバーを作成して実行します。

@@ -398,13 +398,13 @@ DEBUG=helloworld:* npm start

このモジュールの中

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/author_detail_page/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/author_detail_page/index.html index 5c4acc7193..6598ed7e3d 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/author_detail_page/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/author_detail_page/index.html @@ -84,6 +84,6 @@ block content

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/author_list_page/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/author_list_page/index.html index f738902bfb..363c25ea64 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/author_list_page/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/author_list_page/index.html @@ -53,12 +53,12 @@ block content

Author List Page - Express Local Library site

-

Note: The appearance of the author lifespan dates is ugly! You can improve this using the same approach as we used for the BookInstance list (adding the virtual property for the lifespan to the Author model). This time, however, there are missing dates, and references to nonexistent properties are ignored unless strict mode is in effect. moment() returns the current time, and you don't want missing dates to be formatted as if they were today. One way to deal with this is to define the body of the function that returns a formatted date so it returns a blank string unless the date actually exists. For example:

+

Note: The appearance of the author lifespan dates is ugly! You can improve this using the same approach as we used for the BookInstance list (adding the virtual property for the lifespan to the Author model). This time, however, there are missing dates, and references to nonexistent properties are ignored unless strict mode is in effect. moment() returns the current time, and you don't want missing dates to be formatted as if they were today. One way to deal with this is to define the body of the function that returns a formatted date so it returns a blank string unless the date actually exists. For example:

return this.date_of_birth ? moment(this.date_of_birth).format('YYYY-MM-DD') : '';

-

Genre list page—challenge!Edit

+

Genre list page—challenge!Edit

In this section you should implement your own genre list page. The page should display a list of all genres in the database, with each genre linked to its associated detail page. A screenshot of the expected result is shown below.

@@ -80,6 +80,6 @@ block content

Next steps

-

Return to Express Tutorial Part 5: Displaying library data.

+

Return to Express Tutorial Part 5: Displaying library data.

-

Proceed to the next subarticle of part 5: Genre detail page.

+

Proceed to the next subarticle of part 5: Genre detail page.

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/book_detail_page/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/book_detail_page/index.html index f2080e6109..0655111870 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/book_detail_page/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/book_detail_page/index.html @@ -107,6 +107,6 @@ block content

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/book_list_page/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/book_list_page/index.html index 4dfc9c5a5e..ec3737a832 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/book_list_page/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/book_list_page/index.html @@ -56,13 +56,13 @@ block content

What does it look like?

-

Run the application (see Testing the routes for the relevant commands) and open your browser to http://localhost:3000/. Then select the All books link. If everything is set up correctly, your site should look something like the following screenshot.

+

Run the application (see Testing the routes for the relevant commands) and open your browser to http://localhost:3000/. Then select the All books link. If everything is set up correctly, your site should look something like the following screenshot.

Book List Page - Express Local Library site

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_detail_page_and_challenge/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_detail_page_and_challenge/index.html index 3c6cace6a5..6ec61cb4ea 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_detail_page_and_challenge/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_detail_page_and_challenge/index.html @@ -87,5 +87,5 @@ block content

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_list_page/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_list_page/index.html index 9bc7ee305f..f196628b07 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_list_page/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/bookinstance_list_page/index.html @@ -64,6 +64,6 @@ block content

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/date_formatting_using_moment/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/date_formatting_using_moment/index.html index 58851991b5..be96007add 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/date_formatting_using_moment/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/date_formatting_using_moment/index.html @@ -53,8 +53,8 @@ translation_of: Learn/Server-side/Express_Nodejs/Displaying_data/Date_formatting

Next steps

 

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/flow_control_using_async/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/flow_control_using_async/index.html index 0639f79bc3..807f896ed5 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/flow_control_using_async/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/flow_control_using_async/index.html @@ -132,6 +132,6 @@ translation_of: Learn/Server-side/Express_Nodejs/Displaying_data/flow_control_us

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/genre_detail_page/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/genre_detail_page/index.html index 40770c5ef2..2edc3229bc 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/genre_detail_page/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/genre_detail_page/index.html @@ -57,7 +57,7 @@ exports.genre_detail = function(req, res, next) { }
-

The message will then propagate through to our error handling code (this was set up when we generated the app skeleton - for more information see Handling Errors).

+

The message will then propagate through to our error handling code (this was set up when we generated the app skeleton - for more information see Handling Errors).

The rendered view is genre_detail and it is passed variables for the title, genre and the list of books in this genre (genre_books).

@@ -116,6 +116,6 @@ block content

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/home_page/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/home_page/index.html index 3e2f337370..74a74b3109 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/home_page/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/home_page/index.html @@ -9,7 +9,7 @@ translation_of: Learn/Server-side/Express_Nodejs/Displaying_data/Home_page

Route

-

We created our index page routes in a previous tutorial. As a reminder, all the route functions are defined in /routes/catalog.js:

+

We created our index page routes in a previous tutorial. As a reminder, all the route functions are defined in /routes/catalog.js:

// GET catalog home page.
 router.get('/', book_controller.index);  //This actually maps to /catalog/ because we import the route with a /catalog prefix
@@ -27,7 +27,7 @@ router.get('/', book_controller.index); //This actually maps to /catalog/ becau

The index controller function needs to fetch information about how many Book, BookInstance, available BookInstance, Author, and Genre records we have in the database, render this data in a template to create an HTML page, and then return it in an HTTP response.

-

Note: We use the countDocuments() method to get the number of instances of each model. This is called on a model with an optional set of conditions to match against in the first argument and a callback in the second argument (as discussed in Using a Database (with Mongoose), and you can also return a Query and then execute it with a callback later. The callback will be returned when the database returns the count, with an error value (or null) as the first parameter and the count of records (or null if there was an error) as the second parameter.

+

Note: We use the countDocuments() method to get the number of instances of each model. This is called on a model with an optional set of conditions to match against in the first argument and a callback in the second argument (as discussed in Using a Database (with Mongoose), and you can also return a Query and then execute it with a callback later. The callback will be returned when the database returns the count, with an error value (or null) as the first parameter and the count of records (or null if there was an error) as the second parameter.

SomeModel.countDocuments({ a_model_field: 'match_value' }, function (err, count) {
  // ... do something if there is an err
@@ -128,6 +128,6 @@ block content
 

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/index.html index 5726b6c0e1..3877cc76f3 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/index.html @@ -80,13 +80,13 @@ translation_of: Learn/Server-side/Express_Nodejs/Displaying_data

このモジュール

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/locallibrary_base_template/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/locallibrary_base_template/index.html index a97c536eb2..91d52ad66f 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/locallibrary_base_template/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/locallibrary_base_template/index.html @@ -49,7 +49,7 @@ html(lang='en')

The template uses (and includes) JavaScript and CSS from Bootstrap to improve the layout and presentation of the HTML page. Using Bootstrap or another client-side web framework is a quick way to create an attractive page that can scale well on different browser sizes, and it also allows us to deal with the page presentation without having to get into any of the details—we just want to focus on the server-side code here!

-

The layout should be fairly obvious if you've read our above Template primer. Note the use of block content as a placeholder for where the content for our individual pages will be placed.

+

The layout should be fairly obvious if you've read our above Template primer. Note the use of block content as a placeholder for where the content for our individual pages will be placed.

The base template also references a local css file (style.css) that provides a little additional styling. Open /public/stylesheets/style.css and replace its content with the following CSS code:

@@ -64,6 +64,6 @@ html(lang='en')

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/displaying_data/template_primer/index.html b/files/ja/learn/server-side/express_nodejs/displaying_data/template_primer/index.html index a68921a6a7..f8029cb236 100644 --- a/files/ja/learn/server-side/express_nodejs/displaying_data/template_primer/index.html +++ b/files/ja/learn/server-side/express_nodejs/displaying_data/template_primer/index.html @@ -17,7 +17,7 @@ translation_of: Learn/Server-side/Express_Nodejs/Displaying_data/Template_primer

Template configuration

-

The LocalLibrary was configured to use Pug when we created the skeleton website. You should see the pug module included as a dependency in the website's package.json file, and the following configuration settings in the app.js file. The settings tell us that we're using pug as the view engine, and that Express should search for templates in the /views subdirectory.

+

The LocalLibrary was configured to use Pug when we created the skeleton website. You should see the pug module included as a dependency in the website's package.json file, and the following configuration settings in the app.js file. The settings tell us that we're using pug as the view engine, and that Express should search for templates in the /views subdirectory.

// View engine setup.
 app.set('views', path.join(__dirname, 'views'));
@@ -121,7 +121,7 @@ else
 
 

Across a site, it is usual for all pages to have a common structure, including standard HTML markup for the head, footer, navigation, etc. Rather than forcing developers to duplicate this "boilerplate" in every page, Pug allows you to declare a base template and then extend it, replacing just the bits that are different for each specific page.

-

For example, the base template layout.pug created in our skeleton project looks like this:

+

For example, the base template layout.pug created in our skeleton project looks like this:

doctype html
 html
@@ -144,6 +144,6 @@ block content
 

Next steps

diff --git a/files/ja/learn/server-side/express_nodejs/forms/index.html b/files/ja/learn/server-side/express_nodejs/forms/index.html index ea3d378895..bf47160aaf 100644 --- a/files/ja/learn/server-side/express_nodejs/forms/index.html +++ b/files/ja/learn/server-side/express_nodejs/forms/index.html @@ -185,7 +185,7 @@ sanitizeBody('date').toDate(),

In order to implement our form handling code, we will need two routes that have the same URL pattern. The first (GET) route is used to display a new empty form for creating the object. The second route (POST) is used for validating data entered by the user, and then saving the information and redirecting to the detail page (if the data is valid) or redisplaying the form with errors (if the data is invalid).

-

We have already created the routes for all our model's create pages in /routes/catalog.js (in a previous tutorial). For example, the genre routes are shown below:

+

We have already created the routes for all our model's create pages in /routes/catalog.js (in a previous tutorial). For example, the genre routes are shown below:

// GET request for creating a Genre. NOTE This must come before route that displays Genre (uses id).
 router.get('/genre/create', genre_controller.genre_create_get);
@@ -199,12 +199,12 @@ router.post('/genre/create', genre_controller.genre_create_post);
 

The following sub articles will take us through the process of adding the required forms to our example application. You need to read and work through each one in turn, before moving on to the next one.

    -
  1. Create Genre form — Defining a page to create Genre objects.
  2. -
  3. Create Author form — Defining a page to create Author objects.
  4. -
  5. Create Book form — Defining a page/form to create Book objects.
  6. -
  7. Create BookInstance form — Defining a page/form to create BookInstance objects.
  8. -
  9. Delete Author form — Defining a page to delete Author objects.
  10. -
  11. Update Book form — Defining page to update Book objects.
  12. +
  13. Create Genre form — Defining a page to create Genre objects.
  14. +
  15. Create Author form — Defining a page to create Author objects.
  16. +
  17. Create Book form — Defining a page/form to create Book objects.
  18. +
  19. Create BookInstance form — Defining a page/form to create BookInstance objects.
  20. +
  21. Delete Author form — Defining a page to delete Author objects.
  22. +
  23. Update Book form — Defining page to update Book objects.

Challenge yourself

@@ -251,13 +251,13 @@ router.post('/genre/create', genre_controller.genre_create_post);

このモジュール

diff --git a/files/ja/learn/server-side/express_nodejs/index.html b/files/ja/learn/server-side/express_nodejs/index.html index a7ddf93fe5..a858409c44 100644 --- a/files/ja/learn/server-side/express_nodejs/index.html +++ b/files/ja/learn/server-side/express_nodejs/index.html @@ -27,7 +27,7 @@ translation_of: Learn/Server-side/Express_Nodejs

このモジュールを始める前に、サーバーサイドのウェブプログラミングとウェブフレームワークが何かを理解する必要があります。理想的なのはサーバーサイドのウェブサイトプログラミングの第一歩モジュールのトピックを読むことです。プログラミングの概念と JavaScript の一般的な知識があることを強くお勧めしますが、中核となる概念を理解するために不可欠ではありません。

-

メモ: このウェブサイトには、クライアントサイド開発のコンテキストで JavaScript を学習するための多くの有用なリソースがあります。JavaScriptJavaScript ガイドJavaScript の基本JavaScript (学習)。JavaScript のコアとなる言語と概念は、Node.js でのサーバーサイド開発と同じであり、この資料は関連性があります。Node.js は、ブラウザーレス環境で役立つ機能をサポートするための追加の API を提供します (たとえば、HTTP サーバーを作成してファイルシステムにアクセスするため。ただし、ブラウザーおよび DOM を操作するための JavaScript API はサポートしません)。

+

メモ: このウェブサイトには、クライアントサイド開発のコンテキストで JavaScript を学習するための多くの有用なリソースがあります。JavaScriptJavaScript ガイドJavaScript の基本JavaScript (学習)。JavaScript のコアとなる言語と概念は、Node.js でのサーバーサイド開発と同じであり、この資料は関連性があります。Node.js は、ブラウザーレス環境で役立つ機能をサポートするための追加の API を提供します (たとえば、HTTP サーバーを作成してファイルシステムにアクセスするため。ただし、ブラウザーおよび DOM を操作するための JavaScript API はサポートしません)。

このガイドは Node.js と Express を使った作業についての情報を提供します。インターネットや本には他にもたくさんの優れたリソースがあります。これらのうち一部は How do I get started with Node.js (StackOverflow) と What are the best resources for learning Node.js? (Quora) からリンクされています。

diff --git a/files/ja/learn/server-side/express_nodejs/introduction/index.html b/files/ja/learn/server-side/express_nodejs/introduction/index.html index c194cff772..3957d95df4 100644 --- a/files/ja/learn/server-side/express_nodejs/introduction/index.html +++ b/files/ja/learn/server-side/express_nodejs/introduction/index.html @@ -34,7 +34,7 @@ translation_of: Learn/Server-side/Express_Nodejs/Introduction

Node の紹介

-

Node (正式には Node.js) はオープンソースのクロスプラットフォーム、実行環境で、開発者はあらゆるサーバーサイドのツールやアプリケーションを JavaScript で作成することができます。この実行環境はブラウザーコンテキスト外での使用 (すなわち、コンピューターまたはサーバー OS 上での直接実行) を目的としています。そのため、クライアントサイドではブラウザー固有の JavaScript API が省略され、HTTP やファイルシステムライブラリを含む従来の OS API がサポートされます

+

Node (正式には Node.js) はオープンソースのクロスプラットフォーム、実行環境で、開発者はあらゆるサーバーサイドのツールやアプリケーションを JavaScript で作成することができます。この実行環境はブラウザーコンテキスト外での使用 (すなわち、コンピューターまたはサーバー OS 上での直接実行) を目的としています。そのため、クライアントサイドではブラウザー固有の JavaScript API が省略され、HTTP やファイルシステムライブラリを含む従来の OS API がサポートされます

ウェブサーバー開発の観点から Node には多くの利点があります。

diff --git a/files/ja/learn/server-side/express_nodejs/mongoose/index.html b/files/ja/learn/server-side/express_nodejs/mongoose/index.html index e6eecb4496..5d3b3dccc9 100644 --- a/files/ja/learn/server-side/express_nodejs/mongoose/index.html +++ b/files/ja/learn/server-side/express_nodejs/mongoose/index.html @@ -569,7 +569,7 @@ SomeModel.find(callback_function);

Install Mongoose

-

Open a command prompt and navigate to the directory where you created your skeleton Local Library website. Enter the following command to install Mongoose (and its dependencies) and add it to your package.json file, unless you have already done so when reading the Mongoose Primer above.

+

Open a command prompt and navigate to the directory where you created your skeleton Local Library website. Enter the following command to install Mongoose (and its dependencies) and add it to your package.json file, unless you have already done so when reading the Mongoose Primer above.

npm install mongoose
 
@@ -787,13 +787,13 @@ module.exports = mongoose.model('BookInstance', BookInstanceSchema);

このモジュール

diff --git a/files/ja/learn/server-side/express_nodejs/routes/index.html b/files/ja/learn/server-side/express_nodejs/routes/index.html index bb3e21898b..3ee8532a09 100644 --- a/files/ja/learn/server-side/express_nodejs/routes/index.html +++ b/files/ja/learn/server-side/express_nodejs/routes/index.html @@ -24,7 +24,7 @@ translation_of: Learn/Server-side/Express_Nodejs/routes

Overview

-

In the last tutorial article we defined Mongoose models to interact with the database, and used a (standalone) script to create some initial library records. We can now write the code to present that information to users. The first thing we need to do is determine what information we want to be able to display in our pages, and then define appropriate URLs for returning those resources. Then we're going to need to create the routes (URL handlers) and views (templates) to display those pages.

+

In the last tutorial article we defined Mongoose models to interact with the database, and used a (standalone) script to create some initial library records. We can now write the code to present that information to users. The first thing we need to do is determine what information we want to be able to display in our pages, and then define appropriate URLs for returning those resources. Then we're going to need to create the routes (URL handlers) and views (templates) to display those pages.

The diagram below is provided as a reminder of the main flow of data and things that need to be implemented when handling an HTTP request/response. In addition to the views and routes the diagram shows "controllers" — functions that separate out the code to route requests from the code that actually processes requests.

@@ -49,7 +49,7 @@ translation_of: Learn/Server-side/Express_Nodejs/routes

There are several ways to create routes. For this tutorial we're going to use the express.Router middleware as it allows us to group the route handlers for a particular part of a site together and access them using a common route-prefix. We'll keep all our library-related routes in a "catalog" module, and, if we add routes for handling user accounts or other functions, we can keep them grouped separately.

-

Note: We discussed Express application routes briefly in our Express Introduction > Creating route handlers. Other than providing better support for modularization (as discussed in the first subsection below), using Router is very similar to defining routes directly on the Express application object.

+

Note: We discussed Express application routes briefly in our Express Introduction > Creating route handlers. Other than providing better support for modularization (as discussed in the first subsection below), using Router is very similar to defining routes directly on the Express application object.

The rest of this section provides an overview of how the Router can be used to define the routes.

@@ -103,7 +103,7 @@ app.use('/wiki', wiki);

The callback takes three arguments (usually named as shown: req, res, next), that will contain the HTTP Request object, HTTP response, and the next function in the middleware chain.

-

Note: Router functions are Express middleware, which means that they must either complete (respond to) the request or call the next function in the chain. In the case above we complete the request using send(), so the next argument is not used (and we choose not to specify it).

+

Note: Router functions are Express middleware, which means that they must either complete (respond to) the request or call the next function in the chain. In the case above we complete the request using send(), so the next argument is not used (and we choose not to specify it).

The router function above takes a single callback, but you can specify as many callback arguments as you want, or an array of callback functions. Each function is part of the middleware chain, and will be called in the order it is added to the chain (unless a preceding function completes the request).

@@ -135,7 +135,7 @@ app.use('/wiki', wiki);
  • () : Grouping match on a set of characters to perform another operation on. E.g. '/ab(cd)?e' will peform a ? match on (cd) —it will match abe and abcde.
  • -

    The route paths can also be JavaScript regular expressions. For example, the route path below will match catfish and dogfish, but not catflap, catfishhead, and so on. Note that the path for a regular expression uses regular expression syntax (it is not a quoted string as in the previous cases).

    +

    The route paths can also be JavaScript regular expressions. For example, the route path below will match catfish and dogfish, but not catflap, catfishhead, and so on. Note that the path for a regular expression uses regular expression syntax (it is not a quoted string as in the previous cases).

    app.get(/.*fish$/, function (req, res) {
       ...
    @@ -587,7 +587,7 @@ SET DEBUG=express-locallibrary-tutorial:* & npm start
     DEBUG=express-locallibrary-tutorial:* npm start
     
    -
  • If you previously set up nodemon, you can instead use: +
  • If you previously set up nodemon, you can instead use:
    // Windows
     SET DEBUG=express-locallibrary-tutorial:* & npm run devstart
     
    @@ -628,13 +628,13 @@ SET DEBUG=express-locallibrary-tutorial:* & npm run devstartこのモジュール
     
     
    diff --git a/files/ja/learn/server-side/express_nodejs/skeleton_website/index.html b/files/ja/learn/server-side/express_nodejs/skeleton_website/index.html
    index 5b0acfecd2..574ffd2076 100644
    --- a/files/ja/learn/server-side/express_nodejs/skeleton_website/index.html
    +++ b/files/ja/learn/server-side/express_nodejs/skeleton_website/index.html
    @@ -500,13 +500,13 @@ block content
     

    このモジュール

    diff --git a/files/ja/learn/server-side/express_nodejs/tutorial_local_library_website/index.html b/files/ja/learn/server-side/express_nodejs/tutorial_local_library_website/index.html index 9e4dc43e1e..b76f22d669 100644 --- a/files/ja/learn/server-side/express_nodejs/tutorial_local_library_website/index.html +++ b/files/ja/learn/server-side/express_nodejs/tutorial_local_library_website/index.html @@ -86,13 +86,13 @@ translation_of: Learn/Server-side/Express_Nodejs/Tutorial_local_library_website

    このモジュールの中

    -- cgit v1.2.3-54-g00ecf