express-gateway-service-registry
Version:
With self-registration, each microservice is responsible for adding itself to the gateway when it comes online.
55 lines (54 loc) • 1.44 kB
TypeScript
import { Config } from '../types';
export interface Policies {
proxy: Action[];
}
export interface Action {
action: {
changeOrigin: boolean;
stripPath: boolean;
serviceEndpoint: string;
};
}
export interface PipeLineData {
apiEndpoints: string[];
policies: Policies[];
}
declare class ApiService {
protected http: import("axios").AxiosStatic;
protected baseUrl?: string;
protected get<T>(path: string, params?: {}): Promise<import("axios").AxiosResponse<any, any>>;
protected put<T>(path: string, body?: any): Promise<any>;
protected post<T>(path: string, body?: any): Promise<import("axios").AxiosResponse<any, any>>;
protected delete<T>(path: string): Promise<import("axios").AxiosResponse<any, any>>;
}
export declare class GatewayService extends ApiService {
constructor(gc: Config);
/**
*
* @param name
* @param data
* @returns
*/
registerApiEndPoint(name: string, data: {
host: string;
paths: [] | string;
}): Promise<any>;
/**
*
* @param serviceEndPointName
* @param data
* @returns
*/
registerServiceEndPoints(serviceEndPointName: string, data: {
url?: string;
urls?: string[];
}): Promise<any>;
/**
*
* @param name
* @param data
* @returns
*/
registerPipelines(name: string, data: PipeLineData): Promise<any>;
}
export {};