Ala'a .H
Ala'a .H

Reputation: 113

Asp.net hosted multiple blazor apps

I dividing my website into multiple blazor apps in which each module should be routed by a sub path eg: products module should be accessed by the url "domain/products" etc.

so in the configure method in my asp.net core server project when calling

app.UseBlazor<Products.Startup>()

whats the proper way to rout all the single page app url through "domain/products/*"

thanks

Upvotes: 1

Views: 1685

Answers (2)

D.j. Matthews
D.j. Matthews

Reputation: 43

If your like me that's looking for this now, this will get you what you need (as far as I can tell)

            app.Map("/site1", app =>
            {
                app.UseRouting();
                app.UseAuthorization();
                app.UseClientSideBlazorFiles<Site1.Startup>();
                app.UseEndpoints(endpoints =>
                {
                    endpoints.MapFallbackToClientSideBlazor<Darixidor.Site.Startup>("index.html");
                });
            });

Upvotes: 0

Flores
Flores

Reputation: 8942

You can host your blazor app in a sub folder with:

app.Map("/subfolder", child => { child.UseBlazor<Blazor.Program>(); });

And change the basepath of your blazor app in the index.html like this:

<base href="/subfolder/" />

Upvotes: 1

Related Questions