nxkit
Version:
This is a collection of tools, independent of any other libraries
61 lines (60 loc) • 1.61 kB
TypeScript
/// <reference types="node" />
import { Service } from './service';
import * as http from 'http';
declare type RouterInfo = Dict;
/**
* @class StaticService
*/
export declare class StaticService extends Service {
private m_no_cache?;
private m_markCompleteResponse?;
private get _root();
get isCompleteResponse(): boolean;
/**
* response of server
* @type {http.ServerRequest}
*/
readonly response: http.ServerResponse;
/**
* @constructor
* @arg req {http.ServerRequest}
* @arg res {http.ServerResponse}
* @arg info {Object}
*/
constructor(req: http.IncomingMessage, res: http.ServerResponse);
protected markCompleteResponse(): void;
/**
* @overwrite
*/
action(info: RouterInfo): void;
/**
* returnRedirect
* @param {String} path
*/
returnRedirect(path: string): void;
/**
* return the state to the browser
* @param {Number} statusCode
* @param {String} text (Optional) not default status ,return text
*/
returnErrorStatus(statusCode: number, html?: string): void;
/**
* 返回站点文件
*/
returnSiteFile(name: string): Promise<void>;
isAcceptGzip(filename: string): boolean;
isGzip(filename: string): boolean;
setDefaultHeader(expires?: number): void;
setNoCache(): void;
/**
* return file to browser
* @param {String} filename
*/
returnFile(filename: string): void;
/**
* return dir
* @param {String} filename
*/
returnDirectory(filename: string): void;
}
export {};