M
M
mindgrow2019-04-05 09:30:33
ASP.NET
mindgrow, 2019-04-05 09:30:33

What type of ASP .NET Core project would you recommend for a React app?

Good afternoon! I am planning an architecture for a React application and came across the fact that ASP NET Core offers templates that are different in their structure. The main difference is that in terms of projects, the application is built on controllers and chtml views (that is, there are Controllers, Views, Models folders and, accordingly, there are controllers and chtml pages and links between them) in such types of projects, I see a strong binding to controllers from which the conclusion is born that a full stack approach is required to work on such projects, when one programmer develops both front and back.
In other kinds of projects like Web API, front is supposed to be placed in the wwwroot folder. And interaction with controllers happens through js ajax. I see a similar structure as more suitable. it is possible to separate front and back and there is no link to controllers and razor.
What is your opinion about both approaches - pros and cons?
I found many examples of using react based on the first type of templates. But it would be interesting to see an example of development based on templates of the second type, has anyone seen an example?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-04-05
@alexr64

What's in WebAPI, what's in MVC are all the same controllers. The only difference is that either json or a view is returned in the methods. Look for examples here
In any case, you will need models, like ViewModels to build JSON (you are not going to generate json by hand, right?), And some kind of business logic.
Ideally, your business logic (all) should be separate. Controllers are just a bridge between business models and output (it's views, json - it doesn't matter).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question