61 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export type ProxyInfo = {
/**
* 代理路径, 比如/root/center, 匹配的路径
*/
path?: string;
/**
* 目标地址
*/
target?: string;
/**
* 类型
*/
type?: 'file' | 'dynamic' | 'minio' | 'http';
/**
* 目标的 pathname 默认为请求的url.pathname, 设置了pathname则会使用pathname作为请求的url.pathname
* @default undefined
* @example /api/v1/user
*/
pathname?: string;
/**
* 是否使用websocket, http
* @default false
*/
ws?: boolean;
/**
* 首要文件比如index.html type为fileProxy代理有用 设置了首要文件,如果文件不存在,则访问首要文件
*/
indexPath?: string;
/**
* 根路径, 默认是process.cwd(), type为fileProxy代理有用必须为绝对路径
*/
rootPath?: string;
};
export type ApiList = {
path: string;
/**
* url或者相对路径
*/
target: string;
/**
* 目标地址
*/
ws?: boolean;
/**
* 类型
*/
type?: 'static' | 'dynamic' | 'minio';
}[];
/**
[
{
path: '/api/v1/user',
target: 'http://localhost:3000/api/v1/user',
type: 'dynamic',
},
]
*/