Menu

How Frontend Talks to Backend — REST, JSON, and CORS Explained Without the Jargon
📰
0

How Frontend Talks to Backend — REST, JSON, and CORS Explained Without the Jargon

DEV Community·Prathamesh Dhadbale·about 1 month ago
#ZFOHWFTd
Reading 0:00
15s threshold

You've got a React app on one side. An Express server on the other. And you know you need to connect them somehow. But then come the questions — what exactly is an API? What makes it "REST"? Why does everyone use JSON? And why does CORS lose its mind the moment you try to fetch something? Let's answer all of it. First — what even is an API? API stands for Application Programming Interface. But forget the full form, here's what it actually means: Your frontend is a customer. Your backend is a restaurant kitchen. The kitchen doesn't let customers walk in and grab food themselves. Instead there's a menu — a fixed list of things you can order, with specific names and rules. That menu is your API. Your backend doesn't expose its database directly to the frontend. Instead it says — "here are the URLs you can call, here's what you send me, here's what I'll send back." The frontend doesn't know or care how the backend stores data internally. It just knows the menu and orders from it. What makes an API "REST"?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More