DefinitelyTyped/types/koa-static-server/index.d.ts
wulunyi 9b1b3dbc5d koa-static-server(feat) (#29353)
add koa-static-server types
2018-10-01 21:19:23 -07:00

59 lines
1.5 KiB
TypeScript

// Type definitions for koa-static-server 1.3
// Project: https://github.com/pkoretic/koa-static-server
// Definitions by: wulunyi <https://github.com/wulunyi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/* =================== USAGE ===================
import serve = require("koa-static-server");
var Koa = require('koa');
var app = new Koa();
app.use(serve(serve({rootDir: 'web'}));
=============================================== */
import { Middleware } from "koa";
declare function KoaStaticServer(options: KoaStaticServer.Options): Middleware;
declare namespace KoaStaticServer {
interface Options {
/**
* directory that is to be served
*/
rootDir?: string;
/**
* optional rewrite path
*/
rootPath?: string;
/**
* optional default file to serve if requested static is missing
*/
notFoundFile?: string;
/**
* request access log to console
*/
log?: boolean;
/**
* don't execute any downstream middleware. defaults to true
*/
last?: boolean;
/**
* Browser cache max-age in milliseconds. defaults to 0
*/
maxage?: number;
/**
* Allow transfer of hidden files. defaults to false
*/
hidden?: boolean;
/**
* Try to serve the gzipped version of a file automatically when gzip is supported by a client and if the requested
*/
gzip?: boolean;
index?: string;
}
}
export = KoaStaticServer;