Skip to content

Commit f981df7

Browse files
make server type more generic to allow for more frameworks (#235)
* make server type more generic * add more specific typing for server
1 parent 0dc2d70 commit f981df7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/resources/http.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ import { HttpClient } from '@nitric/proto/http/v1/http_grpc_pb';
1717
import { SERVICE_BIND } from '../constants';
1818
import * as grpc from '@grpc/grpc-js';
1919
import { ClientMessage, HttpProxyRequest } from '@nitric/proto/http/v1/http_pb';
20-
import { Server } from 'http';
21-
import { Http2SecureServer, Http2Server } from 'http2';
2220

23-
type ServerType = Server | Http2Server | Http2SecureServer;
21+
interface ServerType {
22+
on: (
23+
eventType: 'close',
24+
callback: () => void,
25+
options?: Record<string, any>
26+
) => void;
27+
close?: () => void;
28+
}
2429

2530
type ListenerFunction =
2631
| ((port: number, callback?: () => void) => ServerType | Promise<ServerType>)

0 commit comments

Comments
 (0)