I have an Angular 5 application that I want to host using Angular Universal on ASP.net Core using the latest Angular template RC . I followed the documents and ran the application. The problem is that I also use Angular i18n tools , which produce several compiled applications, 1 per locale. I need to be able to post each one https://myhost.com/{locale}/.
I know that I can deploy an instance of the ASP.net Core application for each locale and configure hosting on the web server to have a suitable path to the corresponding application, but this seems excessive to me.
Routes are configured using:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
Spa services configured with:
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
spa.UseSpaPrerendering(options =>
{
options.BootModulePath = $"{spa.Options.SourcePath}/dist-server/main.bundle.js";
options.BootModuleBuilder = env.IsDevelopment()
? new AngularCliBuilder(npmScript: "build:ssr:en")
: null;
options.ExcludeUrls = new[] { "/sockjs-node" };
options.SupplyData = (context, data) =>
{
data["foo"] = "bar";
};
});
if (env.IsDevelopment())
{
spa.UseAngularCliServer(npmScript: "start");
}
});
I looked through the documentation and source on Github, and I cannot find how to configure ASP.net Core to associate a specific route with this SPA. Does anyone have any idea?
source
share