useFetch composable in Nux.js 3 is not working for localhost endpoint

75 Views Asked by At

The backend is in python which has endpoint /blogs. When called from useFetch composable with http://localhost:8991/blog. I'm getting fetch failed error, but if I use http://127.0.0.1/blogs it works fine.

Please explain me the logic behind this.

<template>
</template>

<script setup>
const { data, pending, error } = await useFetch('http://127.0.0.1:8992/blogs')
</script>

Changed URL from localhost to 127.0.0.1

0

There are 0 best solutions below