use node_modules folder as static folder /lib
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "node_modules")),
RequestPath = "/lib",
OnPrepareResponse = ctx =>
{
ctx.Context.Response.Headers.Append("Cache-Control", "public,max-age=600");
}
});
npm commands
npm init --yes
npm i jquery bootstrap jquery-validation jquery-validation-unobtrusive -s
sample package.json
{
"name": "Your App",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "dotnet watch run",
"prod": "dotnet run"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^5.2.2",
"jquery": "^3.6.1",
"jquery-validation": "^1.19.5",
"jquery-validation-unobtrusive": "^4.0.0"
}
}