mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 18:19:40 +00:00
Fix various path issues
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
using Microsoft.Dnx.Runtime;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
|
||||
namespace Microsoft.AspNet.NodeServices {
|
||||
public static class Configuration {
|
||||
public static void AddNodeServices(this IServiceCollection serviceCollection, NodeHostingModel hostingModel = NodeHostingModel.Http) {
|
||||
serviceCollection.AddSingleton(typeof(INodeServices), (serviceProvider) => {
|
||||
return CreateNodeServices(hostingModel);
|
||||
var appEnv = serviceProvider.GetRequiredService<IApplicationEnvironment>();
|
||||
return CreateNodeServices(hostingModel, appEnv.ApplicationBasePath);
|
||||
});
|
||||
}
|
||||
|
||||
public static INodeServices CreateNodeServices(NodeHostingModel hostingModel)
|
||||
public static INodeServices CreateNodeServices(NodeHostingModel hostingModel, string projectPath)
|
||||
{
|
||||
switch (hostingModel)
|
||||
{
|
||||
case NodeHostingModel.Http:
|
||||
return new HttpNodeInstance();
|
||||
return new HttpNodeInstance(projectPath);
|
||||
case NodeHostingModel.InputOutputStream:
|
||||
return new InputOutputStreamNodeInstance();
|
||||
return new InputOutputStreamNodeInstance(projectPath);
|
||||
default:
|
||||
throw new System.ArgumentException("Unknown hosting model: " + hostingModel.ToString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user