Package Exports
- koa-better-serve
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (koa-better-serve) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
koa-better-serve

Small, simple and correct serving of files, using koa-send - nothing more.
Install
npm i koa-better-serve --saveUsage
For more use-cases see the tests
const koaBetterServe = require('koa-better-serve')koaBetterServe
Serving
dirof files and folders, when request url (ctx.url) match topathname. All behind the scenes is just using koa-send. Hint: use koa-convert to use it for koa v1.
Params
<dir>{String|Buffer}: folder to serve[pathname]{String|RegExp}: path to match, can be regex[opts]{Object}: optional, passed directly to koa-sendreturns{Function}: plugin which returnsPromisewhen called
Example
const serve = require('koa-better-serve')
const Koa = require('koa')
const app = new Koa()
app.use(serve('./uploads/images', '/images'))
app.listen(4290)Related
- koa-bel: View engine for
koawithout any deps, built to be used with… more | homepage - koa-better-body: Full-featured koa body parser! Support parsing text, buffer, json, json patch, json… more | homepage
- koa-better-ratelimit: Better, smaller, faster - koa middleware for limit request by ip, store… more | homepage
- koa-ip-filter: Middleware for koa that filters IPs against glob patterns, RegExp, string or… more | homepage
- nanomatch: Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.