3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Node.Js

Posted at

Node.js とは?
⇨本来フロントエンドの言語であるjavascriptをサーバーサイド言語として使うための仕組み。

Node.jsを使わなかった場合↓
スクリーンショット 2022-07-09 16.13.14.png

使った場合↓スクリーンショット 2022-07-09 16.16.48.png

Node.jsのメリット
①リアルタイムな処理が速い 
⇨ツイッターなどのリアルタイムで画面が更新されるアプリ開発に向いている

Node.jsのデメリット
①対応しているサーバーが少ない

基本用語
①ルーティング=クライアント側からリクエストが飛んできた時に、そのリクエストを処理することをルーティングという
コードで見てみると
a.get('url',()=>{//トップ画面表示してね(リクエスト)})
{//トップ画面表示してね(リクエスト)⇦この処理をすることを「ルーティング」

②req(リクエスト)res(レスポンス) ⇨リクエスト、レスポンスにはリクエスト・レスポンスに関する情報が入っています。
a.get('url',(req,res)=>{//トップ画面表示してね(リクエスト)})
reqにはこのURLの情報等が入っている

③res.render(’ファイル名’)=指定したurlの中身を画面に表示するねって意味
a.get('url',(req,res)=>{res.render(’ファイル名’)})
resにはurlの中身のファイルの情報が入っている。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?