DEV Community

Discussion on: Note App - Part 1: Setup the Node API

Collapse
 
talk2sohail profile image
Sohail • Edited

Your code is wonderful and comprehensive.
I have one question..
What is the purpose of 'cors' you used in index.js?
Thank you.

Collapse
 
akhilaariyachandra profile image
Akhila Ariyachandra

'cors' is needed if we're going to use the API from a different domain or port. Without 'cors' we won't be able to connect the API to any other apps, like the React app we're going to develop in the next post. As far as running the API in just this post, 'cors' isn't needed. Hope that helps!

Collapse
 
talk2sohail profile image
Sohail

Understood.
Thanks.