mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 20:13:03 +00:00
17 lines
1.9 KiB
JSON
17 lines
1.9 KiB
JSON
{
|
|
"id": "ea75325c41794ef949a26089",
|
|
"source": "solid:signals",
|
|
"type": "github-document",
|
|
"title": "get",
|
|
"content": "---\ntitle: GET\nuse_cases: \u003e-\n http caching, rest api, data fetching, cache headers, seo optimization, cdn\n caching\ntags:\n - http\n - get\n - cache\n - api\n - rest\n - fetch\nversion: '1.0'\ndescription: \u003e-\n Create cacheable GET server functions in SolidStart. Leverage HTTP cache\n headers for improved performance and SEO optimization.\n---\n\n`GET` helps to create a server function which is accessed via an [HTTP GET request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET).\nWhen this function is called, arguments are serialized into the URL, thus allowing the use of [HTTP cache-control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) headers.\n\nFor example, `GET` can be used to make a streaming promise with a 60 second cache life:\n\n```tsx {4, 8}\nimport { json } from \"@solidjs/router\";\nimport { GET } from \"@solidjs/start\";\n\nconst hello = GET(async (name: string) =\u003e {\n\t\"use server\";\n\treturn json(\n\t\t{ hello: new Promise\u003cstring\u003e((r) =\u003e setTimeout(() =\u003e r(name), 1000)) },\n\t\t{ headers: { \"cache-control\": \"max-age=60\" } }\n\t);\n});\n```\n\n## Parameters\n\n`GET\u003cT extends (...args: any[]) =\u003e any\u003e(fn: T): (...args: Parameters\u003cT\u003e) =\u003e ReturnType\u003cT\u003e`",
|
|
"url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/solid-start/reference/server/get.mdx",
|
|
"metadata": {
|
|
"path": "src/routes/solid-start/reference/server/get.mdx",
|
|
"repo": "solidjs/solid-docs",
|
|
"repo_url": "https://github.com/solidjs/solid-docs.git",
|
|
"size": 1189,
|
|
"source_type": "github"
|
|
},
|
|
"hash": "0836f3c59fa2a40ee8652756ff7561ec07890e821d0142fc2d88c726adb07d7c",
|
|
"timestamp": "2026-02-23T11:43:00.195270158+01:00"
|
|
} |