UNPKG

@mvx/mvc

Version:

@mvx/mvc is mvc framework on server, base on koa, @tsdi frameworks

65 lines (64 loc) 1.75 kB
/// <reference types="node" /> import { IContext } from './IContext'; import { ViewResult } from './results/ViewResult'; import { FileResult, FileResultOption } from './results/FileResult'; import { RedirectResult } from './results/RedirectResult'; import { JsonResult } from './results/JsonResult'; import { Stream } from 'stream'; /** * Base Controller. * * @export * @class Controller */ export declare class BaseController { protected context: IContext; constructor(); /** * respone view result. * * @param {string} viewName * @param {object} [model] * @returns * @memberof BaseController */ view(viewName: string, model?: object): ViewResult; /** * respone file result. * * @param {(string | Buffer | Stream)} file * @param {options} [FileResultOption] * @returns * @memberof BaseController */ file(file: string | Buffer | Stream, options?: FileResultOption): FileResult; /** * respone redirect result. * Perform a 302 redirect to `url`. * * The string "back" is special-cased * to provide Referrer support, when Referrer * is not present `alt` or "/" is used. * * Examples: * * this.redirect('back'); * this.redirect('back', '/index.html'); * this.redirect('/login'); * this.redirect('http://google.com'); * @param {string} url * @param {string} [alt] * @returns * @memberof BaseController */ redirect(url: string, alt?: string): RedirectResult; /** * respone json result. * * @param {object} data * @returns * @memberof BaseController */ json(data: object): JsonResult; static ρAnn(): any; }