mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
55 lines
2.0 KiB
C#
Executable File
55 lines
2.0 KiB
C#
Executable File
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.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();
|
|
|
|
// For real apps, you should only use Webpack Dev Middleware at development time. For production,
|
|
// you'll get better performance and reliability if you precompile the webpack output and simply
|
|
// serve the resulting static files. For examples of setting up this automatic switch between
|
|
// development-style and production-style webpack usage, see the 'templates' dir in this repo.
|
|
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())
|
|
.UseIISIntegration()
|
|
.UseKestrel()
|
|
.UseStartup<Startup>()
|
|
.Build();
|
|
|
|
host.Run();
|
|
}
|
|
}
|
|
}
|