0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

語源のfetchとは「取りに行く」の意味です。
エンジニア界隈で使われるfetchも語源と同様にデータを取ってくる(fetchする)の意味で使われます。

JavaScriptでのfetch関数

個人的に一番よく使うし分かりやすいのはfetch関数です。

fetch関数は、HTTPリクエストを送る関数です。
引数にリクエストを送るURLを入れると、リクエストが送信できます。

fetch('https://api.example.com/data', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Alice' })
});

つまり、fetchは主にHTTPリクエストを送ってサーバーからデータを取得する処理のことを言います。

その他のfetch

「fetch」という言葉は 「取りに行く」 という意味で、いろんな場所で使われます。

名前 説明
git fetch Gitでリモートリポジトリの最新情報を取得するコマンド。ローカルのブランチにはマージされず、単に情報だけ取得する。
Linux/Unixのfetch FreeBSD系で使われるコマンドで、ファイルをHTTP/FTPからダウンロードする。curlやwgetみたいなもの。
API fetch 他の言語やフレームワークでも「fetch」という関数があり、サーバーやDBからデータを取りに行く操作を指すことが多い。
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?