@mjackson/node-fetch-server
Advanced tools
| import * as http from 'node:http'; | ||
| import * as http2 from 'node:http2'; | ||
@@ -69,6 +70,9 @@ interface ClientAddress { | ||
| /** | ||
| * Wraps a fetch handler in a Node.js `http.RequestListener` that can be used with | ||
| * [`http.createServer()`](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener) or | ||
| * [`https.createServer()`](https://nodejs.org/api/https.html#httpscreateserveroptions-requestlistener). | ||
| * Wraps a fetch handler in a Node.js request listener that can be used with: | ||
| * | ||
| * - [`http.createServer()`](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener) | ||
| * - [`https.createServer()`](https://nodejs.org/api/https.html#httpscreateserveroptions-requestlistener) | ||
| * - [`http2.createServer()`](https://nodejs.org/api/http2.html#http2createserveroptions-onrequesthandler) | ||
| * - [`http2.createSecureServer()`](https://nodejs.org/api/http2.html#http2createsecureserveroptions-onrequesthandler) | ||
| * | ||
| * Example: | ||
@@ -98,6 +102,7 @@ * | ||
| /** | ||
| * Creates a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object from a Node.js | ||
| * [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) and | ||
| * [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) pair. | ||
| * Creates a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object from | ||
| * | ||
| * - a [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage)/[`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) pair | ||
| * - a [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#class-http2http2serverrequest)/[`http2.Http2ServerResponse`](https://nodejs.org/api/http2.html#class-http2http2serverresponse) pair | ||
| * | ||
| * @param req The incoming request object. | ||
@@ -108,6 +113,6 @@ * @param res The server response object. | ||
| */ | ||
| declare function createRequest(req: http.IncomingMessage, res: http.ServerResponse, options?: RequestOptions): Request; | ||
| declare function createRequest(req: http.IncomingMessage | http2.Http2ServerRequest, res: http.ServerResponse | http2.Http2ServerResponse, options?: RequestOptions): Request; | ||
| /** | ||
| * Creates a [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object from the headers | ||
| * in a Node.js [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage). | ||
| * Creates a [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object from the headers in a Node.js | ||
| * [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage)/[`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#class-http2http2serverrequest). | ||
| * | ||
@@ -117,6 +122,7 @@ * @param req The incoming request object. | ||
| */ | ||
| declare function createHeaders(req: http.IncomingMessage): Headers; | ||
| declare function createHeaders(req: http.IncomingMessage | http2.Http2ServerRequest): Headers; | ||
| /** | ||
| * Sends a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) to the client using the | ||
| * Node.js [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) object. | ||
| * Sends a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) to the client using a Node.js | ||
| * [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse)/[`http2.Http2ServerResponse`](https://nodejs.org/api/http2.html#class-http2http2serverresponse) | ||
| * object. | ||
| * | ||
@@ -126,4 +132,4 @@ * @param res The server response object. | ||
| */ | ||
| declare function sendResponse(res: http.ServerResponse, response: Response): Promise<void>; | ||
| declare function sendResponse(res: http.ServerResponse | http2.Http2ServerResponse, response: Response): Promise<void>; | ||
| export { type ClientAddress, type ErrorHandler, type FetchHandler, type RequestListenerOptions, type RequestOptions, createHeaders, createRequest, createRequestListener, sendResponse }; |
| import * as http from 'node:http'; | ||
| import * as http2 from 'node:http2'; | ||
@@ -69,6 +70,9 @@ interface ClientAddress { | ||
| /** | ||
| * Wraps a fetch handler in a Node.js `http.RequestListener` that can be used with | ||
| * [`http.createServer()`](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener) or | ||
| * [`https.createServer()`](https://nodejs.org/api/https.html#httpscreateserveroptions-requestlistener). | ||
| * Wraps a fetch handler in a Node.js request listener that can be used with: | ||
| * | ||
| * - [`http.createServer()`](https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener) | ||
| * - [`https.createServer()`](https://nodejs.org/api/https.html#httpscreateserveroptions-requestlistener) | ||
| * - [`http2.createServer()`](https://nodejs.org/api/http2.html#http2createserveroptions-onrequesthandler) | ||
| * - [`http2.createSecureServer()`](https://nodejs.org/api/http2.html#http2createsecureserveroptions-onrequesthandler) | ||
| * | ||
| * Example: | ||
@@ -98,6 +102,7 @@ * | ||
| /** | ||
| * Creates a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object from a Node.js | ||
| * [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage) and | ||
| * [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) pair. | ||
| * Creates a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object from | ||
| * | ||
| * - a [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage)/[`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) pair | ||
| * - a [`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#class-http2http2serverrequest)/[`http2.Http2ServerResponse`](https://nodejs.org/api/http2.html#class-http2http2serverresponse) pair | ||
| * | ||
| * @param req The incoming request object. | ||
@@ -108,6 +113,6 @@ * @param res The server response object. | ||
| */ | ||
| declare function createRequest(req: http.IncomingMessage, res: http.ServerResponse, options?: RequestOptions): Request; | ||
| declare function createRequest(req: http.IncomingMessage | http2.Http2ServerRequest, res: http.ServerResponse | http2.Http2ServerResponse, options?: RequestOptions): Request; | ||
| /** | ||
| * Creates a [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object from the headers | ||
| * in a Node.js [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage). | ||
| * Creates a [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers) object from the headers in a Node.js | ||
| * [`http.IncomingMessage`](https://nodejs.org/api/http.html#class-httpincomingmessage)/[`http2.Http2ServerRequest`](https://nodejs.org/api/http2.html#class-http2http2serverrequest). | ||
| * | ||
@@ -117,6 +122,7 @@ * @param req The incoming request object. | ||
| */ | ||
| declare function createHeaders(req: http.IncomingMessage): Headers; | ||
| declare function createHeaders(req: http.IncomingMessage | http2.Http2ServerRequest): Headers; | ||
| /** | ||
| * Sends a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) to the client using the | ||
| * Node.js [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse) object. | ||
| * Sends a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) to the client using a Node.js | ||
| * [`http.ServerResponse`](https://nodejs.org/api/http.html#class-httpserverresponse)/[`http2.Http2ServerResponse`](https://nodejs.org/api/http2.html#class-http2http2serverresponse) | ||
| * object. | ||
| * | ||
@@ -126,4 +132,4 @@ * @param res The server response object. | ||
| */ | ||
| declare function sendResponse(res: http.ServerResponse, response: Response): Promise<void>; | ||
| declare function sendResponse(res: http.ServerResponse | http2.Http2ServerResponse, response: Response): Promise<void>; | ||
| export { type ClientAddress, type ErrorHandler, type FetchHandler, type RequestListenerOptions, type RequestOptions, createHeaders, createRequest, createRequestListener, sendResponse }; |
+1
-1
| { | ||
| "name": "@mjackson/node-fetch-server", | ||
| "version": "0.6.0", | ||
| "version": "0.6.1", | ||
| "description": "Build servers for Node.js using the web fetch API", | ||
@@ -5,0 +5,0 @@ "author": "Michael Jackson <mjijackson@gmail.com>", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
27653
5.76%421
1.45%