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=💡}
|
2022-04-16 13:53:36 +00:00
|
|
|
Nuxt will automatically read files in the `~/server/api` directory to create API endpoints.
|
2022-03-30 15:59:28 +00:00
|
|
|
::
|
|
|
|
|
2022-04-06 05:56:08 +00:00
|
|
|
::ReadMore{link="/api/composables/use-fetch"}
|
|
|
|
::
|
|
|
|
|
2022-09-13 12:54:31 +00:00
|
|
|
::ReadMore{link="/getting-started/data-fetching"}
|
2022-03-30 15:59:28 +00:00
|
|
|
::
|
|
|
|
|
|
|
|
::sandbox{repo="nuxt/framework" branch="main" dir="examples/composables/use-fetch" file="app.vue"}
|