mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 10:54:49 +00:00
dc47c64f14
Co-authored-by: Daniel Roe <daniel@roe.dev> Co-authored-by: Sébastien Chopin <seb@nuxtjs.com> Co-authored-by: Pooya Parsa <pooya@pi0.io> Co-authored-by: pooya parsa <pyapar@gmail.com> Co-authored-by: Clément Ollivier <clement.o2p@gmail.com>
19 lines
804 B
Markdown
19 lines
804 B
Markdown
---
|
|
title: "$fetch"
|
|
description: Nuxt uses ohmyfetch to expose globally the $fetch helper for making HTTP requests.
|
|
---
|
|
|
|
# `$fetch`
|
|
|
|
Nuxt uses [ohmyfetch](https://github.com/unjs/ohmyfetch) to expose globally the `$fetch` helper for making HTTP requests within your Vue app or API routes.
|
|
|
|
::ReadMore{link="/getting-started/data-fetching"}
|
|
::
|
|
|
|
During server-side rendering, calling `$fetch` to fetch your internal [API routes](/guide/directory-structure/server) will directly call the relevant function (emulating the request), **saving an additional API call**.
|
|
|
|
Note that `$fetch` is the preferred way to make HTTP calls in Nuxt 3 instead of [@nuxt/http](https://github.com/nuxt/http) and [@nuxtjs/axios](https://github.com/nuxt-community/axios-module) that are made for Nuxt 2.
|
|
|
|
::NeedContribution
|
|
::
|