mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Define DefaultNodeHostingModel in one common place so it can be changed easily
This commit is contained in:
@@ -12,7 +12,7 @@ namespace ConsoleApplication
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args) {
|
||||
using (var nodeServices = CreateNodeServices(NodeHostingModel.Http)) {
|
||||
using (var nodeServices = CreateNodeServices(Configuration.DefaultNodeHostingModel)) {
|
||||
MeasureLatency(nodeServices).Wait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@ namespace Microsoft.AspNetCore.NodeServices
|
||||
{
|
||||
public static class Configuration
|
||||
{
|
||||
private static readonly string[] DefaultWatchFileExtensions = {".js", ".jsx", ".ts", ".tsx", ".json", ".html"};
|
||||
public const NodeHostingModel DefaultNodeHostingModel = NodeHostingModel.Http;
|
||||
|
||||
private static readonly string[] DefaultWatchFileExtensions = {".js", ".jsx", ".ts", ".tsx", ".json", ".html"};
|
||||
private static readonly NodeServicesOptions DefaultOptions = new NodeServicesOptions
|
||||
{
|
||||
HostingModel = NodeHostingModel.Http,
|
||||
HostingModel = DefaultNodeHostingModel,
|
||||
WatchFileExtensions = DefaultWatchFileExtensions
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Microsoft.AspNetCore.NodeServices
|
||||
{
|
||||
public NodeServicesOptions()
|
||||
{
|
||||
HostingModel = NodeHostingModel.Http;
|
||||
HostingModel = Configuration.DefaultNodeHostingModel;
|
||||
}
|
||||
|
||||
public NodeHostingModel HostingModel { get; set; }
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
||||
{
|
||||
_nodeServices = _fallbackNodeServices = Configuration.CreateNodeServices(new NodeServicesOptions
|
||||
{
|
||||
HostingModel = NodeHostingModel.Http,
|
||||
HostingModel = Configuration.DefaultNodeHostingModel,
|
||||
ProjectPath = _applicationBasePath
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Builder
|
||||
var hostEnv = (IHostingEnvironment)appBuilder.ApplicationServices.GetService(typeof(IHostingEnvironment));
|
||||
var nodeServices = Configuration.CreateNodeServices(new NodeServicesOptions
|
||||
{
|
||||
HostingModel = NodeHostingModel.Http,
|
||||
HostingModel = Configuration.DefaultNodeHostingModel,
|
||||
ProjectPath = hostEnv.ContentRootPath,
|
||||
WatchFileExtensions = new string[] { } // Don't watch anything
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user