} // End Constructor // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { // NodeServicesServiceCollectionExtensions.AddNodeServices(services); // NodeServicesServiceCollectionExtensions.AddNodeServices(services, options => options.ProjectPath = this.CurrentEnvironment.ContentRootPath); // https://stackoverflow.com/questions/58205735/working-with-spa-services-in-netcore-3-0 // NodeServicesServiceCollectionExtensions.AddNodeServices(services, options => { // // options.ProjectPath = System.AppContext.BaseDirectory; // options.ProjectPath = this.CurrentEnvironment.ContentRootPath; // }); /* * services.AddAuthentication(Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt => * { * System.ReadOnlySpan<byte> publicKey = null; // tokenSettings.PublicKey.ToByteArray(); * * // removing "using" makes it work * using (System.Security.Cryptography.RSA rsa = System.Security.Cryptography.RSA.Create()) * { * rsa.ImportSubjectPublicKeyInfo(publicKey, out _); * Microsoft.IdentityModel.Tokens.RsaSecurityKey key = new Microsoft.IdentityModel.Tokens.RsaSecurityKey(rsa); * * opt.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters * { * IssuerSigningKey = key, * ValidAudience = "tokenSettings.TargetAud", * ValidIssuers = new[] { "tokenSettings.Issuer" }, * RequireSignedTokens = true, * RequireExpirationTime = true, * ValidateLifetime = true, * ValidateAudience = true, * ValidateIssuer = true, * ClockSkew = System.TimeSpan.Zero, * }; * } * }); */ NodeServicesServiceCollectionExtensions.AddNodeServices(services, delegate(Microsoft.AspNetCore.NodeServices.NodeServicesOptions options) { // options.ProjectPath = System.AppContext.BaseDirectory; // options.ProjectPath = System.AppContext.BaseDirectory; options.ProjectPath = this.CurrentEnvironment.ContentRootPath; } ); } // End Sub ConfigureServices
} // End Constructor // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { System.Collections.IDictionary dict = System.Environment.GetEnvironmentVariables(); object path = dict["PATH"]; dict["PATH"] = System.Convert.ToString(path) + ":/root/.nvm/versions/node/v14.3.0/bin"; // Microsoft.AspNetCore.SpaServices // Microsoft.AspNetCore.SpaServices.Extensions NodeServicesServiceCollectionExtensions.AddNodeServices(services, delegate(Microsoft.AspNetCore.NodeServices.NodeServicesOptions options) { // options.ProjectPath = System.AppContext.BaseDirectory; // options.ProjectPath = System.AppContext.BaseDirectory; options.ProjectPath = this.CurrentEnvironment.ContentRootPath; } ); // NodeServicesServiceCollectionExtensions.AddNodeServices(services, options => options.EnvironmentVariables); services.AddControllersWithViews(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Microsoft.AspNetCore.SpaServices.Extensions NodeServicesServiceCollectionExtensions.AddNodeServices(services); services.AddControllers(); }