mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
54 lines
1.6 KiB
C#
Executable File
54 lines
1.6 KiB
C#
Executable File
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNet.SpaServices.Webpack;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using System.IO;
|
|
|
|
namespace Webpack
|
|
{
|
|
public class Startup
|
|
{
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddMvc();
|
|
}
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
|
|
if (env.IsDevelopment()) {
|
|
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
|
|
HotModuleReplacement = true
|
|
});
|
|
}
|
|
|
|
app.UseStaticFiles();
|
|
loggerFactory.AddConsole();
|
|
app.UseMvc(routes =>
|
|
{
|
|
routes.MapRoute(
|
|
name: "default",
|
|
template: "{controller=Home}/{action=Index}/{id?}");
|
|
});
|
|
}
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
var host = new WebHostBuilder()
|
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
.UseDefaultHostingConfiguration(args)
|
|
.UseIISPlatformHandlerUrl()
|
|
.UseKestrel()
|
|
.UseStartup<Startup>()
|
|
.Build();
|
|
|
|
host.Run();
|
|
}
|
|
}
|
|
}
|