FaasJS
Home
  • Guide
  • Documents
  • Starter Template
  • Changelog
  • Ecosystem

    • VS Code Plugin
    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
  • English
  • 简体中文
Home
  • Guide
  • Documents
  • Starter Template
  • Changelog
  • Ecosystem

    • VS Code Plugin
    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
  • English
  • 简体中文

Documents / @faasjs/http / useHttpFunc

Function: useHttpFunc()

useHttpFunc<TParams, TCookie, TSession, TResult>(handler, config?): Func<{[key: string]: any; params?: TParams; }, any, TResult>

A hook to create an HTTP function with specified handler and configuration.

Type Parameters

TParams

TParams extends Record<string, any> = Record<string, any>

The type of the parameters object.

TCookie

TCookie extends Record<string, string> = Record<string, string>

The type of the cookies object.

TSession

TSession extends Record<string, any> = Record<string, any>

The type of the session object.

TResult

TResult = any

The type of the result.

Parameters

handler

() => HttpFuncHandler<TParams, TCookie, TSession, TResult>

The function handler to be used.

config?

Optional configuration object.

http?

HttpConfig

Optional HTTP configuration.

Returns

Func<{[key: string]: any; params?: TParams; }, any, TResult>

The created HTTP function.