Skip to content

Commit 30e4baf

Browse files
committed
IWebHostBuilder updated to IHostBuilder
IHostBuilder set according to Microsoft migration guide, debug preprocessor removed in Startup file, Typescript warnings fixed in FetchData vue file.
1 parent 812b4a9 commit 30e4baf

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

ClientApp/src/views/FetchData.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ export default class FetchDataView extends Vue {
6363
];
6464
6565
private getColor(temperature: number) {
66-
if (temperature < 0) return 'blue'
67-
else if (temperature >= 0 && temperature < 30) return 'green'
68-
else return 'red'
66+
if (temperature < 0) {
67+
return 'blue';
68+
} else if (temperature >= 0 && temperature < 30) {
69+
return 'green';
70+
} else {
71+
return 'red';
72+
}
6973
}
7074
private async created() {
7175
await this.fetchWeatherForecasts();
@@ -79,7 +83,7 @@ export default class FetchDataView extends Vue {
7983
this.showError = true;
8084
this.errorMessage = `Error while loading weather forecast: ${e.message}.`;
8185
}
82-
this.loading = false
86+
this.loading = false;
8387
}
8488
}
8589
</script>

Program.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using Microsoft.AspNetCore;
71
using Microsoft.AspNetCore.Hosting;
8-
using Microsoft.Extensions.Configuration;
9-
using Microsoft.Extensions.Logging;
2+
using Microsoft.Extensions.Hosting;
103

114
namespace AspNetCoreVueStarter
125
{
@@ -17,8 +10,15 @@ public static void Main(string[] args)
1710
CreateWebHostBuilder(args).Build().Run();
1811
}
1912

20-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21-
WebHost.CreateDefaultBuilder(args)
22-
.UseStartup<Startup>();
13+
public static IHostBuilder CreateWebHostBuilder(string[] args) =>
14+
Host.CreateDefaultBuilder(args)
15+
.ConfigureWebHostDefaults(webBuilder =>
16+
{
17+
webBuilder.ConfigureKestrel(serverOptions =>
18+
{
19+
// Set properties and call methods on options
20+
})
21+
.UseStartup<Startup>();
22+
});
2323
}
2424
}

Startup.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5555
name: "default",
5656
pattern: "{controller}/{action=Index}/{id?}");
5757

58-
#if DEBUG
59-
if (System.Diagnostics.Debugger.IsAttached)
60-
endpoints.MapToVueCliProxy("{*path}", new SpaOptions { SourcePath = "ClientApp" }, "serve", regex: "Compiled successfully");
61-
else
62-
#endif
63-
// note: output of vue cli or quasar cli should be wwwroot
64-
endpoints.MapFallbackToFile("index.html");
58+
endpoints.MapToVueCliProxy("{*path}",
59+
new SpaOptions { SourcePath = "ClientApp" },
60+
"serve"
61+
//, regex: "Compiled successfully"
62+
);
6563
});
6664

6765
//app.UseSpa(spa =>

0 commit comments

Comments
 (0)