How to get strapi 4 api data in nuxt 3

System Information
  • Strapi Version: 4.15.5
  • Operating System: Windows 11
  • Database: pgAdmin
  • Node Version: v19.0.0
  • NPM Version: 8.10.0
  • Yarn Version:

app.vue

<script setup lang="ts">
const { data } = await useFetch('http://localhost:1337/api/books') // replace by your api url
</script>

<template>
  <pre>{{ JSON.stringify(data) }}</pre>
</template>

Please refer to the nuxt documentation :