IntriguingTiles / cleverbot-free

Simple package to interact with the same API that the Cleverbot website uses for free.
MIT License
37 stars 10 forks source link

Access to XMLHttpRequest has been blocked? #41

Closed ForgoneReality closed 2 years ago

ForgoneReality commented 2 years ago

Hi! I'm sort of a novice to programming and I keep getting this error in my React/JS program and open it up on localhost:3000

Access to XMLHttpRequest has been blocked by CORS policy No Access-Control-Allow-Origin header found

How do I fix this? I'm not really sure how and where to add said header either... Sorry for the dumb question

IntriguingTiles commented 2 years ago

Unfortunately, there is no way to use cleverbot-free directly in the browser because CORS, by default, prevents one site from making requests to other sites unless it has been explicitly allowed by the other site. What you could do is use cleverbot-free server-side and expose an endpoint for the browser to use.