title: How to host Angular application with Kestrel
body: <p>I am trying to deploy an <code>Angular 7</code> application with  <code>.NET Core</code> using <code>Kestrel</code> using the <code>FileProvider</code> extension.</p>
  
  <p>I have created the angular app , i have <code>ng build</code> it and i copied the files inside <code>dist</code>  <code>.NET</code> Porject. </p>
  
  <p><strong>Startup</strong></p>
  
  <pre><code> public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
          string jsFolderName = "myroot";
          string prodRoot =Path.Combine(AppDomain.CurrentDomain.BaseDirectory,jsFolderName);
          string debugRoot =Path.Combine(Directory.GetCurrentDirectory(),jsFolderName);
  
          var isDev=env.IsDevelopment();
  
  
          DefaultFilesOptions options = new DefaultFilesOptions();
          options.DefaultFileNames.Clear();
          options.DefaultFileNames.Add("/myroot/index.html");
          app.UseDefaultFiles(options);
          app.UseStaticFiles();
          app.UseStaticFiles(new StaticFileOptions() {
              FileProvider = new PhysicalFileProvider(isDev?debugRoot:prodRoot),
              RequestPath = "/app"
          });
          if (env.IsDevelopment()) {
              app.UseDeveloperExceptionPage();
          } else {
              app.UseHsts();
          }
  
          app.UseHttpsRedirection();
          app.UseMvc();
      }
  </code></pre>
  
  <p><strong>P.S</strong> My <code>myroot</code> folder is right in the root of the project.
  I do not know how to feed the first page (entrypoint) of the <code>angular</code> app which is <code>index.html</code>.</p>