Homepage in ASP.NET SPA

52 views Asked by At

I am developing a project from the .NET React template. I want to create a homepage that would be indexed by search engines with Razor, since React pages aren't SEO friendly. How could I achieve this?

I tried creating a Home controller and Home view, using it as default route

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();

app.MapControllerRoute(
  name: "default",
  pattern: "{controller=home}/{action=Index}/{id?}");

//app.MapFallbackToFile("index.html");

And adding the route in the setupProxy.js

const context =  [
  "/api",
  "/home"
];

module.exports = function(app) {
  const appProxy = createProxyMiddleware(context, {
    target: target,
    secure: false,
    headers: {
      Connection: 'Keep-Alive'
    }
  });

  app.use(appProxy);
};
0

There are 0 answers