2022-03-30 15:59:28 +00:00
|
|
|
---
|
|
|
|
template: Example
|
|
|
|
---
|
|
|
|
|
2022-04-06 05:56:08 +00:00
|
|
|
# `useFetch`
|
2022-03-30 15:59:28 +00:00
|
|
|
|
|
|
|
This example shows how to use `useFetch` to fetch data from an API endpoint.
|
|
|
|
|
|
|
|
::alert{type=info icon=💡}
|
|
|
|
Nuxt will automatically read files in the ~/server/api directory to create API endpoints.
|
|
|
|
::
|
|
|
|
|
2022-04-06 05:56:08 +00:00
|
|
|
::ReadMore{link="/api/composables/use-fetch"}
|
|
|
|
::
|
|
|
|
|
|
|
|
::ReadMore{link="/guide/features/data-fetching"}
|
2022-03-30 15:59:28 +00:00
|
|
|
::
|
|
|
|
|
|
|
|
::sandbox{repo="nuxt/framework" branch="main" dir="examples/composables/use-fetch" file="app.vue"}
|