DEV Community

Discussion on: Stop repeating work and Start coding your express API 🚀

Collapse
 
zluther89 profile image
Zach • Edited

I could be wrong, but I don't think cors module is needed by default, I think the setup you have for cors is what express already does by default, the cors module is only needed if you need to make exceptions.

Collapse
 
uptotec profile image
Mahmoud Ashraf Mahmoud

When I started using expess i spent a whole day trying to receive requests from the browser with react js. I was sending requests to the backend with postman and it works fine but it doesn't receive and requests from the browser. And then I found that to be able to receive browser requests you have to use the cors module. So I thought it would be convenient to add it by default as most of express API's will be consumed by some sort of a frontend which may work on a browser 😅

Collapse
 
zluther89 profile image
Zach

It depends on if the server is hosting the page or not. But yeah I see what you mean, makes sense! Really cool project 🤗