3.0.1 • Published 4 years ago

think_static v3.0.1

Weekly downloads
3
License
MIT
Repository
-
Last release
4 years ago

介绍


npm version

Static server Middleware for ThinkKoa.

安装


npm i think_static

使用


1、static中间件为thinkkoa内置中间件,无需在项目中创建引用。该中间件默认开启

2、项目中间件配置 config/middleware.js:

config: { //中间件配置
    ...,
    //静态资源,如果配置了Nginx代理,请设置为 static: false
    static: {
        dir: '/static', // resource path
        prefix: '', // the url prefix you wish to add, default to ''
        alias: {}, // object map of aliases. See below
        gzip: true, // when request's accept-encoding include gzip, files will compressed by gzip.
        usePrecompiledGzip: false, // try use gzip files, loaded from disk, like nginx gzip_static
        buffer: false, // store the files in memory instead of streaming from the filesystem on each request
        filter: [], // (function | array) - filter files at init dir,
        // for example - skip non build (source) files. If array set - allow only listed files
        maxAge: 3600 * 24 * 7, // cache control max age for the files, 0 by default.
        cache: true, // dynamic load file which not cached on initialization.
    }
}
3.0.1

4 years ago

3.0.0

4 years ago

2.2.0

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.2.0

6 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago