ts5deco-express-controller
Version:
TypeScript 5 Modern Decorator Express Controller Framework
45 lines • 1.27 kB
TypeScript
import { Response } from 'express';
import { BaseResponse } from './BaseResponse';
/**
* Redirect response class for HTTP redirects
*
* @example
* ```typescript
* // Temporary redirect (302)
* return new RedirectResponse('/login');
*
* // Permanent redirect (301)
* return new RedirectResponse('/new-path', true);
*
* // Custom status redirect
* return new RedirectResponse('/path', 307);
* ```
*/
export declare class RedirectResponse extends BaseResponse {
readonly url: string;
constructor(url: string, permanent?: boolean);
constructor(url: string, statusCode: number);
send(res: Response): void;
}
/**
* Convenience methods for common redirect responses
*/
export declare class RedirectResponses {
/**
* 302 Found (temporary redirect)
*/
static temporary(url: string): RedirectResponse;
/**
* 301 Moved Permanently (permanent redirect)
*/
static permanent(url: string): RedirectResponse;
/**
* 307 Temporary Redirect (preserves method)
*/
static temporaryPreserveMethod(url: string): RedirectResponse;
/**
* 308 Permanent Redirect (preserves method)
*/
static permanentPreserveMethod(url: string): RedirectResponse;
}
//# sourceMappingURL=RedirectResponse.d.ts.map