2.0.7 • Published 5 months ago

@koa_web/koa-cache v2.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

简介

用到的依赖有dayjs,koa-compose,koa-send,koa-static-cache,winston

安装&配置

$ npm i @koa_web/koa-entry -s

使用

  • 基础用法
const koaEntry = require('ne-koa-entry');

const staticPath = [ dir1, dir2 ];
app.use(koaEntry(
    staticPath // 需要映射静态资源的文件夹列表
));
  • 使用prefix
const staticPath = [ dir1, { path: dir2, prefix: '/template' }];
app.use(koaEntry(
    staticPath // 需要映射静态资源的文件夹列表
));
  • 使用koa-webpack
app.use(koaEntry(
    staticPath, // 需要映射静态资源的文件夹列表
    webpackConfig // webpack配置
));
  • 使用回调函数
app.use(koaEntry(
    staticPath, // 需要映射静态资源的文件夹列表
    webpackConfig, // webpack配置
    ctx => {
        console.log(ctx);
        ctx.body = '无权限访问';
    } // 回调函数,可以拿到ctx, 可以自定义页面内容
));
2.0.7

5 months ago

2.0.6

9 months ago

2.0.5

9 months ago

2.0.4

9 months ago

2.0.3

9 months ago

2.0.2

9 months ago

2.0.1

9 months ago