diff --git a/content/AspNetCore.VueJs/AspNetCore.VueJs.csproj b/content/AspNetCore.VueJs/AspNetCore.VueJs.csproj index 9f83f34..34cd8ac 100644 --- a/content/AspNetCore.VueJs/AspNetCore.VueJs.csproj +++ b/content/AspNetCore.VueJs/AspNetCore.VueJs.csproj @@ -1,66 +1,68 @@  - - netcoreapp3.1 - true - 2.8 - + + net6.0 + enable + enable + true + 2.8 + - - - - - - + + + + + + - - - + + + - - - + + + - - - - - - + - - + + + + - - + + - + + - - - - + - - + + + + - - + + - - - - - - - - - + + - - - $(IncludeRazorContentInPack) - - + + + + + + + + + + + + + $(IncludeRazorContentInPack) + + diff --git a/content/AspNetCore.VueJs/Controllers/IceAndFireController.cs b/content/AspNetCore.VueJs/Controllers/IceAndFireController.cs index b91e6be..d1e40b7 100644 --- a/content/AspNetCore.VueJs/Controllers/IceAndFireController.cs +++ b/content/AspNetCore.VueJs/Controllers/IceAndFireController.cs @@ -2,8 +2,6 @@ using AspNetCore.VueJs.Models; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; -using System.Net.Http; -using System.Threading.Tasks; namespace AspNetCore.VueJs.Controllers { diff --git a/content/AspNetCore.VueJs/Models/ErrorViewModel.cs b/content/AspNetCore.VueJs/Models/ErrorViewModel.cs index 85710c5..e4eb9e1 100644 --- a/content/AspNetCore.VueJs/Models/ErrorViewModel.cs +++ b/content/AspNetCore.VueJs/Models/ErrorViewModel.cs @@ -1,5 +1,3 @@ -using System; - namespace AspNetCore.VueJs.Models { public class ErrorViewModel diff --git a/content/AspNetCore.VueJs/Program.cs b/content/AspNetCore.VueJs/Program.cs index aa8b618..84fa29b 100644 --- a/content/AspNetCore.VueJs/Program.cs +++ b/content/AspNetCore.VueJs/Program.cs @@ -1,18 +1,33 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; +var builder = WebApplication.CreateBuilder(args); -namespace AspNetCore.VueJs +// Add services to the container. +builder.Services.AddHttpClient(); +builder.Services.Configure(options => options.LowercaseUrls = true); +builder.Services.AddControllersWithViews(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseDeveloperExceptionPage(); +} + +app.UseStaticFiles(); + +app.UseRouting(); + +app.UseEndpoints(endpoints => { - public class Program - { - public static void Main(string[] args) - { - BuildWebHost(args).Run(); - } - - public static IWebHost BuildWebHost(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup() - .Build(); - } -} \ No newline at end of file + endpoints.MapControllerRoute( + name: "spa-route", + pattern: "{controller}/{*anything=Index}", + defaults: new { action = "Index" }); + + endpoints.MapControllerRoute( + name: "app-fallback", + pattern: "{*anything}/", + defaults: new { controller = "Template", action = "Index" }); +}); + +app.Run(); \ No newline at end of file diff --git a/content/AspNetCore.VueJs/Properties/launchSettings.json b/content/AspNetCore.VueJs/Properties/launchSettings.json index 8e82ca3..0b1a393 100644 --- a/content/AspNetCore.VueJs/Properties/launchSettings.json +++ b/content/AspNetCore.VueJs/Properties/launchSettings.json @@ -8,13 +8,6 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "AspNetCore.VueJs": { "commandName": "Project", "launchBrowser": true, @@ -22,6 +15,13 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "http://localhost:44203/" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } \ No newline at end of file diff --git a/content/AspNetCore.VueJs/Startup.cs b/content/AspNetCore.VueJs/Startup.cs deleted file mode 100644 index 94a90a5..0000000 --- a/content/AspNetCore.VueJs/Startup.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace AspNetCore.VueJs -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - public void ConfigureServices(IServiceCollection services) - { - services.AddHttpClient(); - - services.Configure(options => options.LowercaseUrls = true); - services.AddMvc(); - } - - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - app.UseStaticFiles(); - - app.UseRouting(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllerRoute( - name: "spa-route", - pattern: "{controller}/{*anything=Index}", - defaults: new { action = "Index" }); - - endpoints.MapControllerRoute( - name: "app-fallback", - pattern: "{*anything}/", - defaults: new { controller = "Template", action = "Index" }); - }); - } - } -} \ No newline at end of file