A
A
Artem Nemtsov2020-02-07 09:39:29
.NET
Artem Nemtsov, 2020-02-07 09:39:29

How to properly render a React application in combination with ASP.NET.CORE 3.1?

When creating a new project in VS 2019 of type ASP.NET.CORE and then using React, there are two options:
1) -- use the Web API template, and all page rendering, etc. hang on the client, because React is used.
For me, this is a convenient option, because. using the same API, I can then connect from other interfaces (phone, Desktop).
2) -- use the NET.CORE with React template. As I understand it, in this case, page rendering will take place on the server.

The application will distribute audio tracks and various information. Which option is better to choose ensuring both the performance and security of the application? What is the best way to organize the storage of a React application, regardless of the server side for in paragraph 1?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2020-02-07
@yarosroman

A similar situation, I have angular + webapi. I have 2 different projects, separate angular, separate webapi. In an angular project, the build is set to wwwroot in the dotnet project. Dotnet webapi template, the Configure method is set to app.UseStaticFiles() and Cors policy is set to a minimum Spa development goes through the built-in angular web server, which supports on-the-fly recompilation and HotReload. I'm debugging WebApi through Postman. Everything in vs code is developed.

V
Vladimir Korotenko, 2020-02-07
@firedragon

dotnet watch run

Try this command to run a net build . I
recommend running the client application with the built-in web server
npm run watch
This is a command from the vue template
What I love about the studio, but here they have done too much and are not very convenient.
The first command looks at the dotnet sources, the
second one rebuilds the client application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question