summaryrefslogtreecommitdiff
path: root/CoreWiki/BuilderExtensions.cs
blob: f68decaa3e61276f7a66546d1b8b76eac77de232 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using Microsoft.Extensions.FileProviders;

namespace CoreWiki;

public static class BuilderExtensions
{
    public static void ServeNodePackage(this IApplicationBuilder app, IHostEnvironment env, string packageName)
    {
        app.UseStaticFiles(new StaticFileOptions()
        {
            FileProvider = new PhysicalFileProvider(
                Path.Combine(env.ContentRootPath, "node_modules/", packageName, "dist")),
            RequestPath = "/lib/" + packageName
        });
    }
}