A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://vercel.com/docs/functions/functions-api-reference below:

Functions API Reference

Functions are defined similar to a Route Handler in Next.js. When using Next.js App Router, you can define a function in a file under app/api/my-route/route.ts in your project. Vercel will deploy any file under app/api/ as a function.

Vercel Functions use a Web Handler, which consists of the request parameter that is an instance of the web standard Request API. Next.js extends the standard Request object with additional properties and methods.

To use a Web Handler, you must be using Node.js 18 or later. If you are using an earlier version, you must use the Node.js signature.

Parameter Description Next.js Other Frameworks request An instance of the Request object NextRequest Request
export function GET(request: Request) {
  return new Response('Hello from Vercel!');
}

To configure your function when using the App Router in Next.js, you use segment options, rather than a config object.

export const runtime = 'nodejs';
export const maxDuration = 15;

The table below shows a highlight of the valid config options. For detailed information on all the config options, see the Configuring Functions docs.

Property Type Description runtime string This optional property defines the runtime to use, and if not set the runtime will default to nodejs. preferredRegion string This optional property and can be used to specify the regions in which your function should execute. This can only be set when the runtime is set to edge maxDuration int This optional property can be used to specify the maximum duration in seconds that your function can run for. This can't be set when the runtime is set to edge

The @vercel/functions package provides a set of helper methods and utilities for working with Vercel Functions.

See the @vercel/functions documentation for more information.

The @vercel/oidc package was previously provided by @vercel/functions/oidc.

The @vercel/oidc package provides helper methods and utilities for working with OpenID Connect (OIDC) tokens.

See the @vercel/oidc documentation for more information.

The @vercel/oidc-aws-credentials-provider package was previously provided by @vercel/functions/oidc.

The @vercel/oidc-aws-credentials-provider package provides helper methods and utilities for working with OpenID Connect (OIDC) tokens and AWS credentials.

See the @vercel/oidc-aws-credentials-provider documentation for more information.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4