How connect frontend and backend? (solved)
I have fronted on react and backend on C#
How I can connect it?
I know something that I need use REST api but I'm absolutely newbie on it
If you know how I can do it DM me please
It depends on what exactly you want connect - in my case it was auth from
You need sever db (like supabase or mongodb) or your local backend sever
In frontend part I needed write smth like this
And output it somehow like this
Book.tsx (its better to wirte interface with TypeScript)
4 Replies
the idea of posting here is that you can learn, but someone else might be able to find your post and learn from it as well. Learning in public is also a much better way of learning, and asking people to DM is a bigger hurdle to try to get help as well.
as for your actual question, REST APIs are a very broad topic, I'd suggest looking up some tutorials online. I'm not familiar with the web landscape for C# at all, so I can't really give any suggestions, but anything recent should do
it's not something someone can just type out in a couple of messages, you'll have to do some of your own research
As Jochem said, that's what REST APIs are for. You code up your API controllers in C# and your front end does some requests to the endpoints (usually using
fetch()
, but some frameworks have their own way of doing it…which ultimately calls fetch()
under the hood :p) and gets data back.
While REST APIs are a basic web concept, they're by no means simple. There's a lot that goes into them, especially if you want to restrict who can do what. Authorization and authentication are super important and not that simple.
For some good C# YT suggestions, I like:
I Am Tim Corey: https://www.youtube.com/@IAmTimCorey
Nick Chapsas: https://www.youtube.com/@nickchapsas
Raw Coding: https://www.youtube.com/@RawCodingIf you are by any chance using Visual Studio (Community edition is free for personal use and is way better than Visual Studio Code for C#) you might want to use this template for your app.
It is ready to use sample app (but you need a NodeJS to build it) with some boilerplate you might reverse-engineer.