D
D
DD-var2021-02-11 13:52:42
ASP.NET
DD-var, 2021-02-11 13:52:42

How to call a controller from react?

I have a home controller in which I add a user. How can I add a user who entered his data?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DD-var, 2021-02-12
@DD-var

figured out how to execute exactly the method / function in the controller.
in fetch we write the path to the controller-method: https://localhost:5051/api/ method
in the controller we write the path
[Route("api/[controller]")]
and above the method / function
[HttpGet/Post("name method")]
after that we start the project and access
https://localhost:5051/api/get - how to access it in a browser or via postman

V
Vasily Bannikov, 2021-02-12
@vabka

await fetch("https://localhost:5051/api/home");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question