adrianhajdin / project_ai_mern_image_generation

Build and Deploy a Full Stack MERN AI Image Generation App MidJourney & DALL E Clone
https://jsmastery.pro
1.08k stars 302 forks source link

CORS ERROR #40

Open MoharTry opened 1 year ago

MoharTry commented 1 year ago

I am getting CORS error. 'Access-Control-Allow-Origin' header is present on the requested resource. I also tried switching browsers but it doesn't help. Please let me know if anyone has figured it out

Screenshot 2023-04-09 162719

harshit0571 commented 1 year ago

Did you use app.use(cors()) in index.js? In server folder.

harshit0571 commented 1 year ago

Did you use app.use(cors()) in index.js? In server folder.

@MoharTry

MoharTry commented 1 year ago

Did you use app.use(cors()) in index.js? In server folder.

Screenshot 2023-04-10 211558

We have to add it in this way only right ? Please correct me if I am wrong

harshit0571 commented 1 year ago

Did you use app.use(cors()) in index.js? In server folder.

Screenshot 2023-04-10 211558

We have to add it in this way only right ? Please correct me if I am wrong

Yes we have to write like this.

harshit0571 commented 1 year ago

@MoharTry try checking this out. stack-overflow

MoharTry commented 1 year ago

I tried every single response on this webpage but none of them helped Also what should be the Origin address of the webpage ( for origin access )? Should it be "localhost:3000" or "localhost:3000/api/v1/post"? I have added my code on my repo, can you please give a look and tell if I am doing anything wrong ? https://github.com/MoharTry/Imaginary.ai Thank you @harshit0571

ViharGandhi commented 1 year ago

the origin access should be you frontend url

MeghanaNalla commented 1 year ago

.