Skip to main content
Version: 11.x

Type alias: NodeHTTPHandlerOptions<TRouter, TRequest, TResponse>

NodeHTTPHandlerOptions: <TRouter, TRequest, TResponse> HTTPBaseHandlerOptions< TRouter, TRequest > & NodeHTTPCreateContextOption< TRouter, TRequest, TResponse > & {experimental_contentTypeHandlers: NodeHTTPContentTypeHandler< TRequest, TResponse >[]; maxBodySize: number; middleware: ConnectMiddleware;}

NodeHTTPHandlerOptions.experimental_contentTypeHandlers

optional experimental_contentTypeHandlers: NodeHTTPContentTypeHandler< TRequest, TResponse >[]

NodeHTTPHandlerOptions.maxBodySize

optional maxBodySize: number

NodeHTTPHandlerOptions.middleware

optional middleware: ConnectMiddleware

By default, http OPTIONS requests are not handled, and CORS headers are not returned.

This can be used to handle them manually or via the cors npm package: https://www.npmjs.com/package/cors

ts
import cors from 'cors'
nodeHTTPRequestHandler({
cors: cors()
})
ts
import cors from 'cors'
nodeHTTPRequestHandler({
cors: cors()
})

You can also use it for other needs which a connect/node.js compatible middleware can solve, though you might wish to consider an alternative solution like the Express adapter if your needs are complex.

Type parameters

Parameter
TRouter extends AnyTRPCRouter
TRequest extends NodeHTTPRequest
TResponse extends NodeHTTPResponse

Source

packages/server/src/adapters/node-http/types.ts:69


Generated using TypeDoc and typedoc-plugin-markdown