1 | import http from 'http';
|
2 | import express, { Express } from 'express';
|
3 | import { Application as FeathersApplication, Params as FeathersParams, HookContext, ServiceMethods, ServiceInterface, RouteLookup } from '@feathersjs/feathers';
|
4 | interface ExpressUseHandler<T, Services> {
|
5 | <L extends keyof Services & string>(path: L, ...middlewareOrService: (Express | express.RequestHandler | express.RequestHandler[] | (keyof any extends keyof Services ? ServiceInterface : Services[L]))[]): T;
|
6 | (path: string | RegExp, ...expressHandlers: express.RequestHandler[]): T;
|
7 | (...expressHandlers: express.RequestHandler[]): T;
|
8 | (handler: Express | express.ErrorRequestHandler): T;
|
9 | }
|
10 | export interface ExpressOverrides<Services> {
|
11 | listen(port: number, hostname: string, backlog: number, callback?: () => void): Promise<http.Server>;
|
12 | listen(port: number, hostname: string, callback?: () => void): Promise<http.Server>;
|
13 | listen(port: number | string | any, callback?: () => void): Promise<http.Server>;
|
14 | listen(callback?: () => void): Promise<http.Server>;
|
15 | use: ExpressUseHandler<this, Services>;
|
16 | server?: http.Server;
|
17 | }
|
18 | export type Application<Services = any, Settings = any> = Omit<Express, 'listen' | 'use' | 'get' | 'set'> & FeathersApplication<Services, Settings> & ExpressOverrides<Services>;
|
19 | declare module '@feathersjs/feathers/lib/declarations' {
|
20 | interface ServiceOptions {
|
21 | express?: {
|
22 | before?: express.RequestHandler[];
|
23 | after?: express.RequestHandler[];
|
24 | composed?: express.RequestHandler;
|
25 | };
|
26 | }
|
27 | }
|
28 | declare module 'express-serve-static-core' {
|
29 | interface Request {
|
30 | feathers: Partial<FeathersParams> & {
|
31 | [key: string]: any;
|
32 | };
|
33 | lookup?: RouteLookup;
|
34 | }
|
35 | interface Response {
|
36 | data?: any;
|
37 | hook?: HookContext;
|
38 | }
|
39 | interface IRouterMatcher<T> {
|
40 | <P extends Params = ParamsDictionary, ResBody = any, ReqBody = any>(path: PathParams, ...handlers: (RequestHandler<P, ResBody, ReqBody> | Partial<ServiceMethods> | Application)[]): T;
|
41 | }
|
42 | }
|
43 | export {};
|