Switch to using DI to acquire Node instances. Bump versions to alpha2.

This commit is contained in:
SteveSandersonMS
2015-11-02 13:35:14 -08:00
parent 301657a207
commit de991b9858
23 changed files with 103 additions and 92 deletions

View File

@@ -79,6 +79,9 @@ namespace MusicStore
Mapper.CreateMap<ArtistResultDto, Artist>();
Mapper.CreateMap<Genre, GenreResultDto>();
Mapper.CreateMap<GenreResultDto, Genre>();
// Enable Node Services
services.AddNodeServices();
}
// Configure is called after ConfigureServices is called.
@@ -108,17 +111,6 @@ namespace MusicStore
app.UseExceptionHandler("/Home/Error");
}
var nodeInstance = new NodeInstance();
app.Use(async (context, next) => {
if (context.Request.Path.Value.EndsWith(".less")) {
// Note: check for directory traversal
var output = await nodeInstance.Invoke("lessCompiler.js", env.WebRootPath + context.Request.Path.Value);
await context.Response.WriteAsync(output);
} else {
await next();
}
});
// Add static files to the request pipeline.
app.UseStaticFiles();