Skip to content

Commit

Permalink
make server type more generic to allow for more frameworks (#235)
Browse files Browse the repository at this point in the history
* make server type more generic

* add more specific typing for server
  • Loading branch information
HomelessDinosaur authored Jan 15, 2025
1 parent 0dc2d70 commit f981df7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/resources/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any>
) => void;
close?: () => void;
}

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

0 comments on commit f981df7

Please sign in to comment.