Last active
May 25, 2016 00:09
-
-
Save boban100janovski/b456aea4831aff7dbfc144039984e43c to your computer and use it in GitHub Desktop.
asp.net core rc2, serve node_modules folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.PlatformAbstractions; | |
using System.IO; | |
using Microsoft.Extensions.FileProviders; | |
using Microsoft.AspNetCore.Hosting; | |
namespace Microsoft.AspNetCore.Builder | |
{ | |
public static class ApplicationBuilderExtensions | |
{ | |
public static IApplicationBuilder UseNodeModules( | |
this IApplicationBuilder app, | |
IHostingEnvironment env) | |
{ | |
var path = Path.Combine(env.ContentRootPath, "node_modules"); | |
var provider = new PhysicalFileProvider(path); | |
var options = new StaticFileOptions(); | |
options.RequestPath = "/node_modules"; | |
options.FileProvider = provider; | |
app.UseStaticFiles(options); | |
return app; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment