Skip to content

Instantly share code, notes, and snippets.

@Maarten88
Last active March 22, 2017 22:07
Show Gist options
  • Save Maarten88/6f0507332b71ca93578213f5ae8c1a83 to your computer and use it in GitHub Desktop.
Save Maarten88/6f0507332b71ca93578213f5ae8c1a83 to your computer and use it in GitHub Desktop.
var host = new WebHostBuilder()
[...]
.ConfigureServices(services =>
{
[...]
services.AddNodeServices(options => {
if ("development".Equals(environment, StringComparison.OrdinalIgnoreCase))
{
options.LaunchWithDebugging = true;
options.DebuggingPort = 5858;
}
options.NodeInstanceOutputLogger = loggerFactory.CreateLogger("Node Console Logger");
});
[...]
}
.Configure(app =>
{
var env = app.ApplicationServices.GetService<IHostingEnvironment>();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true,
HotModuleReplacementServerPort = 6000,
ReactHotModuleReplacement = true,
});
}
[...]
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapSpaFallbackRoute(
name: "spa-fallback",
defaults: new { controller = "Home", action = "Index" });
});
}
[...]
.Build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment