dotnet / dotnet/aspnetcore

Spa Services running only react pages ?

Open
#56,976 0 comments 0 reactions 0 assignees View on GitHub
area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

We have a web application which runs on .NET 8 (recently we migrated from 5 to 8).
Now the team is planning to build new screens in ReactTS and merge these screens with the existing .NET 8 web application. So, it won't impact on the current customers. We also have a future plan to migrate the existing .NET web screens to React TS in phase wise manner

We are doing a POC with .NET Web APP and ReactTS sample apps we tried different [articles](https://esausilva.com/2020/08/03/add-a-react-app-to-a-dot-net-core-mvc-app/) and approaches to run .NET application and ReactTS application on the Same domain and port number.
Example .NET 8 web app is running on https://localhost:44341 and trying to run ReactTS also on same port and they both reside in same solution.

My solution look like
![image](https://github.com/user-attachments/assets/bb7b18c8-b855-4e9b-87d3-a92d491258dc)

Do we have any documentation for this?

We are using

Startup we added like
` app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
spa.UseReactDevelopmentServer("start");
});`

We are using " Microsoft.AspNetCore.SpaServices.Extensions " package.

### Expected Behavior

We trying to run .NET 8 Web APP and ReactTS on same domain and port simply we are mixing .NET 8 and ReactTS so few screens will run on ReactTS and few screesn will run on .NET 8.

Our POC [here](https://github.com/itsmegopi/ReactWithNet8)

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

8

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.