Server functions

GET

Declares that a server-function read can use HTTP GET. Calls use a cacheable URL when the encoded arguments fit and fall back to a read-only POST when they do not.

See Reads, streams, and live data for caching, URL limits, and HEAD behavior.


Import

import { GET } from "@solidjs/web/server-functions";

Type signature

function GET<A extends readonly any[], R>(
fn: (...args: A) => R
): ServerFunction<A, Awaited<R>>;

Parameters

fn

  • Type: (...args: A) => R

Examples

export const getUser = GET(async (id: string) => {
"use server";
return database.users.find(id);
});

Common problems


Learn more

Last updated: 9/27/26, 8:11 AMEdit this pageReport an issue with this page