From f981df760ba575e2931ccab972849b5db66097e4 Mon Sep 17 00:00:00 2001 From: Ryan Cartwright <39504851+HomelessDinosaur@users.noreply.github.com> Date: Wed, 15 Jan 2025 13:13:34 +1100 Subject: [PATCH] make server type more generic to allow for more frameworks (#235) * make server type more generic * add more specific typing for server --- src/resources/http.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/resources/http.ts b/src/resources/http.ts index c372c42..eed6fe9 100644 --- a/src/resources/http.ts +++ b/src/resources/http.ts @@ -17,10 +17,15 @@ import { HttpClient } from '@nitric/proto/http/v1/http_grpc_pb'; import { SERVICE_BIND } from '../constants'; import * as grpc from '@grpc/grpc-js'; import { ClientMessage, HttpProxyRequest } from '@nitric/proto/http/v1/http_pb'; -import { Server } from 'http'; -import { Http2SecureServer, Http2Server } from 'http2'; -type ServerType = Server | Http2Server | Http2SecureServer; +interface ServerType { + on: ( + eventType: 'close', + callback: () => void, + options?: Record + ) => void; + close?: () => void; +} type ListenerFunction = | ((port: number, callback?: () => void) => ServerType | Promise)