Hi,
I’m trying to get Duckling talking to a frontend & have run into an issue. I’m running Duckling using Docker.
I can send requests & get responses back over CURL & Postman fine, however, when I try this through the frontend app using Svelte JS I run into a CORS issue. I overcome this by setting no-cors in the request headers. I can see the result as expected in the Chrome network tab but can’t get the data in my async fetch post, the console.log(x) below shows no JSON data & has status of 0.
Has anyone else gone done what I have and any success with it? Is there a better approach in talking to Duckling?
Thanks
async function handleClick() {
const url = "http://127.0.0.1:8000/parse"
data = await fetch(url, {
mode: 'no-cors',
method: "POST",
headers: { 'Content-type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
locale: "en_GB",
text: "Next week"
})
})
.then(x => {
console.log(x)
})
}