7
4

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.

javascript(node.js)のrequest.on()を解説

Last updated at Posted at 2020-02-20

reqest.on(イベント名, 関数);

#dataイベント

→ dataイベント
クライアントからデータを受け取ると発生するイベントです。

var body = '';

request.on('data',(data) => {
    body +=data;
}

この引数のdataは、送られてきたデータの事です。

#endイベント

→ endイベント
データの受け取りが完了すると発生するイベントです。

endイベントは、全てデータを受け取った後なので、引数は指定しません。

7
4
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
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?