mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Update KnockoutSpa template to RC2
This commit is contained in:
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace WebApplicationBasic.Controllers
|
namespace WebApplicationBasic.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace WebApplicationBasic.Controllers
|
namespace WebApplicationBasic.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNet.SpaServices.Webpack;
|
using Microsoft.AspNet.SpaServices.Webpack;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
@@ -14,21 +15,9 @@ namespace WebApplicationBasic
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env)
|
|
||||||
{
|
|
||||||
// Set up configuration sources.
|
|
||||||
var builder = new ConfigurationBuilder()
|
|
||||||
.AddJsonFile("appsettings.json")
|
|
||||||
.AddEnvironmentVariables();
|
|
||||||
Configuration = builder.Build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; set; }
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
// Add framework services.
|
|
||||||
services.AddMvc().AddJsonOptions(options =>
|
services.AddMvc().AddJsonOptions(options =>
|
||||||
{
|
{
|
||||||
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||||
@@ -36,32 +25,18 @@ namespace WebApplicationBasic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
|
||||||
{
|
|
||||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
|
||||||
loggerFactory.AddDebug();
|
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
app.UseExceptionHandler("/Home/Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseIISPlatformHandler();
|
if (env.IsDevelopment()) {
|
||||||
|
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
|
||||||
if (env.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
|
|
||||||
{
|
|
||||||
HotModuleReplacement = true
|
HotModuleReplacement = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
loggerFactory.AddConsole();
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
{
|
{
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
@@ -74,7 +49,17 @@ namespace WebApplicationBasic
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entry point for the application.
|
public static void Main(string[] args)
|
||||||
public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args);
|
{
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseDefaultHostingConfiguration(args)
|
||||||
|
.UseIISPlatformHandlerUrl()
|
||||||
|
.UseKestrel()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
@using WebApplicationBasic
|
@using WebApplicationBasic
|
||||||
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
|
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
|
||||||
@addTagHelper "*, Microsoft.AspNet.SpaServices"
|
@addTagHelper "*, Microsoft.AspNet.SpaServices"
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
"emitEntryPoint": true
|
"emitEntryPoint": true,
|
||||||
|
"warningsAsErrors": true,
|
||||||
|
"preserveCompilationContext": true
|
||||||
},
|
},
|
||||||
"tooling": {
|
"tooling": {
|
||||||
"defaultNamespace": "WebApplicationBasic"
|
"defaultNamespace": "WebApplicationBasic"
|
||||||
},
|
},
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
|
"Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
|
||||||
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
|
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
|
"Microsoft.AspNetCore.Mvc": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
|
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
|
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
|
||||||
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
|
"Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
|
||||||
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
|
"Microsoft.Extensions.Configuration.Json": "1.0.0-*",
|
||||||
"Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
|
"Microsoft.Extensions.Logging.Console": "1.0.0-*",
|
||||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
|
"Microsoft.NETCore.Platforms": "1.0.1-*",
|
||||||
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
|
"Microsoft.Extensions.Logging.Debug": "1.0.0-*",
|
||||||
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
|
|
||||||
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
|
|
||||||
"Microsoft.AspNet.SpaServices": "1.0.0-*"
|
"Microsoft.AspNet.SpaServices": "1.0.0-*"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -29,12 +29,20 @@
|
|||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnx451": {},
|
"dnx451": {},
|
||||||
"dnxcore50": {}
|
"netstandardapp1.5": {
|
||||||
|
"imports": [
|
||||||
|
"dnxcore50",
|
||||||
|
"portable-net451+win8"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.5.0-*"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"wwwroot",
|
"wwwroot",
|
||||||
"node_modules",
|
"node_modules"
|
||||||
],
|
],
|
||||||
"publishExclude": [
|
"publishExclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
Reference in New Issue
Block a user