|
7 | 7 | using Microsoft.AspNetCore.SpaServices.Webpack; |
8 | 8 | using Microsoft.Extensions.Configuration; |
9 | 9 | using Microsoft.Extensions.DependencyInjection; |
10 | | -using Microsoft.Extensions.Logging; |
11 | 10 |
|
12 | 11 | namespace WebApplicationBasic |
13 | 12 | { |
14 | 13 | public class Startup |
15 | 14 | { |
16 | | - public Startup(IHostingEnvironment env) |
| 15 | + public Startup(IConfiguration configuration) |
17 | 16 | { |
18 | | - var builder = new ConfigurationBuilder() |
19 | | - .SetBasePath(env.ContentRootPath) |
20 | | - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) |
21 | | - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) |
22 | | - .AddEnvironmentVariables(); |
23 | | - Configuration = builder.Build(); |
| 17 | + Configuration = configuration; |
24 | 18 | } |
25 | 19 |
|
26 | | - public IConfigurationRoot Configuration { get; } |
| 20 | + public IConfiguration Configuration { get; } |
27 | 21 |
|
28 | 22 | // This method gets called by the runtime. Use this method to add services to the container. |
29 | 23 | public void ConfigureServices(IServiceCollection services) |
30 | 24 | { |
31 | | - // Add framework services. |
32 | 25 | services.AddMvc(); |
33 | 26 | } |
34 | 27 |
|
35 | 28 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. |
36 | | - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) |
| 29 | + public void Configure(IApplicationBuilder app, IHostingEnvironment env) |
37 | 30 | { |
38 | | - loggerFactory.AddConsole(Configuration.GetSection("Logging")); |
39 | | - loggerFactory.AddDebug(); |
40 | | - |
41 | 31 | if (env.IsDevelopment()) |
42 | 32 | { |
43 | 33 | app.UseDeveloperExceptionPage(); |
44 | | - app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { |
| 34 | + app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions |
| 35 | + { |
45 | 36 | HotModuleReplacement = true |
46 | 37 | }); |
47 | 38 | } |
|
0 commit comments