Bercovici Adrian
Bercovici Adrian

Reputation: 9380

Common Url for server and client in Blazor

Hello i do not understand the following:

What i want to achieve:

I have a ASP NET Core standalone project that responds with some json to the followig routes : localhost:8300/a
localhost:8300/b

Now i am adding to the solution a simple Blazor project template (not server-sided ,nor client-hosted ) ,just the client project.

How do i set the Url for the client and the server so that i can still respond with json on the mentioned routes , (example from Postman) but i can acess the Blazor client on some chosen route:
[address]:[port]/c
I do not understand the address and the port part.

Upvotes: 0

Views: 1309

Answers (1)

codevision
codevision

Reputation: 5560

Main idea with .NET Code integration for these sorts of problems is create separate WebApplication which will just add references to you API and BlazorClient client projects. Lets call that new App CombinedApp for clearer reference.

if you duplicate initialization of API inside CombinedApp. Inside Startup class you should perform same initialization inside ConfigureServices and Configure methods. That bring routes from API project to the CombinedApp project. Then add UseBlazor<BlazorClient.Program>() in the Configure method of CombinedApp.Startup and then you have both API and BlazorClient sitting in the same project.

Upvotes: 1

Related Questions