From 00c3b32e2db200a2f42396ac7f8381704ec97268 Mon Sep 17 00:00:00 2001 From: Paweł Bernaciak Date: Fri, 10 Feb 2023 16:19:46 +0100 Subject: Initial Commit --- CoreWiki/BuilderExtensions.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CoreWiki/BuilderExtensions.cs (limited to 'CoreWiki/BuilderExtensions.cs') diff --git a/CoreWiki/BuilderExtensions.cs b/CoreWiki/BuilderExtensions.cs new file mode 100644 index 0000000..f68deca --- /dev/null +++ b/CoreWiki/BuilderExtensions.cs @@ -0,0 +1,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 + }); + } +} \ No newline at end of file -- cgit v1.2.3