-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement(deps): remove dependency on fastify and @types/express
By removing the hard dependnecy on the types FastifyRequest, Request, FastifyReply<ServerResponse>, and Response, the fastify and @types/express packages are no longer hard dependencies which will cut down on the package size. To get around this, minimum types were created (or used) to make sure that there could still be a distinction between Fastify and Express requests. fix #4
- Loading branch information
Showing
7 changed files
with
185 additions
and
80 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { IncomingMessage } from 'http'; | ||
|
||
export interface ExpressLikeRequest extends IncomingMessage { | ||
ips: string[]; | ||
ip: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { IncomingMessage, ServerResponse } from 'http'; | ||
|
||
export interface FastifyLikeRequest { | ||
query: Record<string, any>; | ||
params: Record<string, any>; | ||
headers: Record<string, any>; | ||
body: any; | ||
req: IncomingMessage; | ||
id: any; | ||
ip: string; | ||
ips: string[]; | ||
hostname: string; | ||
raw: IncomingMessage; | ||
} | ||
|
||
export interface FastifyLikeResponse { | ||
res: ServerResponse; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ServerResponse } from 'http'; | ||
import { ExpressLikeRequest } from './express-like.interface'; | ||
import { | ||
FastifyLikeRequest, | ||
FastifyLikeResponse, | ||
} from './fastify-like.interface'; | ||
|
||
export type OgmaRequest = FastifyLikeRequest | ExpressLikeRequest; | ||
export type OgmaResponse = FastifyLikeResponse | ServerResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters