
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
koa-static-resolver
Advanced tools
Koa static file resolver, dirs, default index, path replace, cache, livereload, gzip
Koa static file resolver, dirs, default index, path replace, cache, livereload, gzip
npm install koa-static-resolver --save
const Koa = require('koa');
const KSR = require('koa-static-resolver');
const app = new Koa();
app.use(KSR({
dirs: ["./static/", "../node_modules/"],
defaultIndex: "index.html"
}));
app.listen(8080);
app.use(KSR({
dirs: ["./static/"],
//server cache (Memory)
cache: {},
//do NOT cache big size file
cacheMaxLength: 10 * 1024 * 1024,
//browser cache header: max-age=<seconds>
maxAge: 600
}));
app.use(KSR({
dirs: ["./static/"],
livereload: '\n<script src="/livereload.js"></script>\n'
}));
//only inject to .html
app.use(KSR({
dirs: ["./static/"],
cache: {},
gzip: true,
gzipMinLength: 1024,
gzipTypes: [".html", ".css", ".js", ".svg", ".xml"]
}));
//require headers with "Accept-Encoding": "gzip"
app.use(KSR({
dirs: ["./static/"],
include: ["include/folder", /RegExp/],
exclude: ["exclude/folder", /RegExp/]
}));
// any files not matched include/folder will be 404 not found
// any files matched exclude/folder will be 404 not found
// support RegExp
app.use(KSR({
dirs: ["./static/"],
replace: {
"from_path": "to_path"
}
}));
//when request /from_path/some_next_path/, will be replaced with /to_path/some_next_path/ to find out file path
app.use(KSR({
dirs: ["./static/"],
headers: {
"header_key": "header_value"
}
}));
v1.0.5
v1.0.4
v1.0.3
v1.0.2
FAQs
Koa static file resolver, dirs, default index, path replace, cache, livereload, gzip
The npm package koa-static-resolver receives a total of 97,971 weekly downloads. As such, koa-static-resolver popularity was classified as popular.
We found that koa-static-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.