[{"data":1,"prerenderedAt":703},["ShallowReactive",2],{"navigation":3,"-guide-fetch":234,"-guide-fetch-surround":699},[4,81,228],{"title":5,"path":6,"stem":7,"children":8,"icon":10},"Getting Started","/guide","1.guide/0.index",[9,11,16,21,26,31,36,41,46,51,56,61,66,71,76],{"title":5,"path":6,"stem":7,"icon":10},"ph:book-open-duotone",{"title":12,"path":13,"stem":14,"icon":15},"Migration Guide","/guide/migration","1.guide/00.migration","ri:arrow-right-up-line",{"title":17,"path":18,"stem":19,"icon":20},"Server Utils","/guide/utils","1.guide/1.utils","ri:tools-line",{"title":22,"path":23,"stem":24,"icon":25},"Tasks","/guide/tasks","1.guide/10.tasks","codicon:run-all",{"title":27,"path":28,"stem":29,"icon":30},"Server Routes","/guide/routing","1.guide/2.routing","ri:direction-line",{"title":32,"path":33,"stem":34,"icon":35},"WebSocket","/guide/websocket","1.guide/3.websocket","cib:socket-io",{"title":37,"path":38,"stem":39,"icon":40},"KV Storage","/guide/storage","1.guide/4.storage","carbon:datastore",{"title":42,"path":43,"stem":44,"icon":45},"SQL Database","/guide/database","1.guide/5.database","ri:database-2-line",{"title":47,"path":48,"stem":49,"icon":50},"Cache","/guide/cache","1.guide/6.cache","ri:speed-line",{"title":52,"path":53,"stem":54,"icon":55},"Fetch","/guide/fetch","1.guide/7.fetch","ri:global-line",{"title":57,"path":58,"stem":59,"icon":60},"Assets","/guide/assets","1.guide/8.assets","ri:image-2-line",{"title":62,"path":63,"stem":64,"icon":65},"Plugins","/guide/plugins","1.guide/9.plugins","ri:plug-line",{"title":67,"path":68,"stem":69,"icon":70},"Configuration","/guide/configuration","1.guide/97.configuration","ri:settings-3-line",{"title":72,"path":73,"stem":74,"icon":75},"TypeScript","/guide/typescript","1.guide/98.typescript","tabler:brand-typescript",{"title":77,"path":78,"stem":79,"icon":80},"Nightly Channel","/guide/nightly","1.guide/99.nightly","ri:moon-fill",{"title":82,"path":83,"stem":84,"children":85,"icon":87},"Overview","/deploy","2.deploy/0.index",[86,88,92,122,127],{"title":82,"path":83,"stem":84,"icon":87},"ri:upload-cloud-2-line",{"title":89,"path":90,"stem":91,"icon":55},"Edge Workers","/deploy/workers","2.deploy/1.workers",{"title":93,"path":94,"stem":95,"children":96,"page":121},"Runtimes","/deploy/runtimes","2.deploy/10.runtimes",[97,102,106,111,116],{"title":98,"path":99,"stem":100,"icon":101},"Node.js","/deploy/runtimes/node","2.deploy/10.runtimes/1.node","akar-icons:node-fill",{"title":103,"path":104,"stem":105,"icon":25},"Dir","/deploy/runtimes/_dir","2.deploy/10.runtimes/_dir",{"title":107,"path":108,"stem":109,"icon":110},"WinterJS","/deploy/runtimes/_winterjs","2.deploy/10.runtimes/_winterjs","game-icons:cold-heart",{"title":112,"path":113,"stem":114,"icon":115},"Bun","/deploy/runtimes/bun","2.deploy/10.runtimes/bun","simple-icons:bun",{"title":117,"path":118,"stem":119,"icon":120},"Deno","/deploy/runtimes/deno","2.deploy/10.runtimes/deno","simple-icons:deno",false,{"title":123,"path":124,"stem":125,"icon":126},"Custom Preset","/deploy/custom-presets","2.deploy/2.custom-presets","ri:file-code-line",{"title":128,"path":129,"stem":130,"children":131,"page":121},"Providers","/deploy/providers","2.deploy/20.providers",[132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224],{"title":103,"path":133,"stem":134,"icon":135},"/deploy/providers/_dir","2.deploy/20.providers/_dir","tdesign:cloud",{"title":137,"path":138,"stem":139},"Alwaysdata","/deploy/providers/alwaysdata","2.deploy/20.providers/alwaysdata",{"title":141,"path":142,"stem":143},"AWS Lambda","/deploy/providers/aws","2.deploy/20.providers/aws",{"title":145,"path":146,"stem":147},"AWS Amplify","/deploy/providers/aws-amplify","2.deploy/20.providers/aws-amplify",{"title":149,"path":150,"stem":151},"Azure","/deploy/providers/azure","2.deploy/20.providers/azure",{"title":153,"path":154,"stem":155},"Cleavr","/deploy/providers/cleavr","2.deploy/20.providers/cleavr",{"title":157,"path":158,"stem":159},"Cloudflare","/deploy/providers/cloudflare","2.deploy/20.providers/cloudflare",{"title":161,"path":162,"stem":163},"Deno Deploy","/deploy/providers/deno-deploy","2.deploy/20.providers/deno-deploy",{"title":165,"path":166,"stem":167},"DigitalOcean","/deploy/providers/digitalocean","2.deploy/20.providers/digitalocean",{"title":169,"path":170,"stem":171},"Firebase","/deploy/providers/firebase","2.deploy/20.providers/firebase",{"title":173,"path":174,"stem":175},"Flightcontrol","/deploy/providers/flightcontrol","2.deploy/20.providers/flightcontrol",{"title":177,"path":178,"stem":179},"Genezio","/deploy/providers/genezio","2.deploy/20.providers/genezio",{"title":181,"path":182,"stem":183},"GitHub Pages","/deploy/providers/github-pages","2.deploy/20.providers/github-pages",{"title":185,"path":186,"stem":187},"GitLab Pages","/deploy/providers/gitlab-pages","2.deploy/20.providers/gitlab-pages",{"title":189,"path":190,"stem":191},"Heroku","/deploy/providers/heroku","2.deploy/20.providers/heroku",{"title":193,"path":194,"stem":195},"IIS","/deploy/providers/iis","2.deploy/20.providers/iis",{"title":197,"path":198,"stem":199},"Koyeb","/deploy/providers/koyeb","2.deploy/20.providers/koyeb",{"title":201,"path":202,"stem":203},"Netlify","/deploy/providers/netlify","2.deploy/20.providers/netlify",{"title":205,"path":206,"stem":207},"Platform.sh","/deploy/providers/platform-sh","2.deploy/20.providers/platform-sh",{"title":209,"path":210,"stem":211},"Render.com","/deploy/providers/render","2.deploy/20.providers/render",{"title":213,"path":214,"stem":215},"StormKit","/deploy/providers/stormkit","2.deploy/20.providers/stormkit",{"title":217,"path":218,"stem":219},"Vercel","/deploy/providers/vercel","2.deploy/20.providers/vercel",{"title":221,"path":222,"stem":223},"Zeabur","/deploy/providers/zeabur","2.deploy/20.providers/zeabur",{"title":225,"path":226,"stem":227},"Zerops","/deploy/providers/zerops","2.deploy/20.providers/zerops",{"title":229,"path":230,"stem":231,"children":232,"icon":70},"Config","/config","3.config/0.index",[233],{"title":229,"path":230,"stem":231,"icon":70},{"id":235,"title":52,"body":236,"description":693,"extension":694,"meta":695,"navigation":696,"path":53,"seo":697,"stem":54,"__hash__":698},"content/1.guide/7.fetch.md",{"type":237,"value":238,"toc":689,"icon":55},"minimark",[239,244,253,352,358,444,450,592,606,610,616,676,685],[240,241,243],"h2",{"id":242},"usage","Usage",[245,246,247,248,252],"p",{},"In your handler, you just have to call the ",[249,250,251],"code",{},"$fetch"," function to make a request. The response will be automatically parsed.",[254,255,261],"pre",{"className":256,"code":257,"filename":258,"language":259,"meta":260,"style":260},"language-ts shiki shiki-themes github-light github-dark github-dark","export default defineEventHandler(async (event) => {\n  const data = await $fetch('https://ungh.cc/orgs/unjs/repos')\n\n  return data\n})\n","Router Handler","ts","",[249,262,263,302,330,337,346],{"__ignoreMap":260},[264,265,268,272,275,279,283,286,289,293,296,299],"span",{"class":266,"line":267},"line",1,[264,269,271],{"class":270},"so5gQ","export",[264,273,274],{"class":270}," default",[264,276,278],{"class":277},"shcOC"," defineEventHandler",[264,280,282],{"class":281},"slsVL","(",[264,284,285],{"class":270},"async",[264,287,288],{"class":281}," (",[264,290,292],{"class":291},"sQHwn","event",[264,294,295],{"class":281},") ",[264,297,298],{"class":270},"=>",[264,300,301],{"class":281}," {\n",[264,303,305,308,312,315,318,321,323,327],{"class":266,"line":304},2,[264,306,307],{"class":270},"  const",[264,309,311],{"class":310},"suiK_"," data",[264,313,314],{"class":270}," =",[264,316,317],{"class":270}," await",[264,319,320],{"class":277}," $fetch",[264,322,282],{"class":281},[264,324,326],{"class":325},"sfrk1","'https://ungh.cc/orgs/unjs/repos'",[264,328,329],{"class":281},")\n",[264,331,333],{"class":266,"line":332},3,[264,334,336],{"emptyLinePlaceholder":335},true,"\n",[264,338,340,343],{"class":266,"line":339},4,[264,341,342],{"class":270},"  return",[264,344,345],{"class":281}," data\n",[264,347,349],{"class":266,"line":348},5,[264,350,351],{"class":281},"})\n",[245,353,354,355,357],{},"You can pass a generic type to the ",[249,356,251],{}," function to get a better type inference.",[254,359,361],{"className":256,"code":360,"filename":258,"language":259,"meta":260,"style":260},"import { Repo } from '~/types'\n\nexport default defineEventHandler(async (event) => {\n  const data = await $fetch\u003CRepo[]>('https://ungh.cc/orgs/unjs/repos')\n\n  return data\n})\n",[249,362,363,377,381,403,428,432,439],{"__ignoreMap":260},[264,364,365,368,371,374],{"class":266,"line":267},[264,366,367],{"class":270},"import",[264,369,370],{"class":281}," { Repo } ",[264,372,373],{"class":270},"from",[264,375,376],{"class":325}," '~/types'\n",[264,378,379],{"class":266,"line":304},[264,380,336],{"emptyLinePlaceholder":335},[264,382,383,385,387,389,391,393,395,397,399,401],{"class":266,"line":332},[264,384,271],{"class":270},[264,386,274],{"class":270},[264,388,278],{"class":277},[264,390,282],{"class":281},[264,392,285],{"class":270},[264,394,288],{"class":281},[264,396,292],{"class":291},[264,398,295],{"class":281},[264,400,298],{"class":270},[264,402,301],{"class":281},[264,404,405,407,409,411,413,415,418,421,424,426],{"class":266,"line":339},[264,406,307],{"class":270},[264,408,311],{"class":310},[264,410,314],{"class":270},[264,412,317],{"class":270},[264,414,320],{"class":277},[264,416,417],{"class":281},"\u003C",[264,419,420],{"class":277},"Repo",[264,422,423],{"class":281},"[]>(",[264,425,326],{"class":325},[264,427,329],{"class":281},[264,429,430],{"class":266,"line":348},[264,431,336],{"emptyLinePlaceholder":335},[264,433,435,437],{"class":266,"line":434},6,[264,436,342],{"class":270},[264,438,345],{"class":281},[264,440,442],{"class":266,"line":441},7,[264,443,351],{"class":281},[245,445,446,447,449],{},"You can pass many options to the ",[249,448,251],{}," function like the method, headers, body, query, etc.",[254,451,453],{"className":256,"code":452,"filename":258,"language":259,"meta":260,"style":260},"import { Repo } from '~/types'\n\nexport default defineEventHandler(async (event) => {\n  const data = await $fetch\u003CRepo[]>('https://api.github.com/markdown', {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/json'\n    },\n    body: {\n      text: 'Hello **world**!'\n    }\n  })\n\n  return data\n})\n",[249,454,455,465,469,491,515,526,531,542,548,554,563,569,575,580,587],{"__ignoreMap":260},[264,456,457,459,461,463],{"class":266,"line":267},[264,458,367],{"class":270},[264,460,370],{"class":281},[264,462,373],{"class":270},[264,464,376],{"class":325},[264,466,467],{"class":266,"line":304},[264,468,336],{"emptyLinePlaceholder":335},[264,470,471,473,475,477,479,481,483,485,487,489],{"class":266,"line":332},[264,472,271],{"class":270},[264,474,274],{"class":270},[264,476,278],{"class":277},[264,478,282],{"class":281},[264,480,285],{"class":270},[264,482,288],{"class":281},[264,484,292],{"class":291},[264,486,295],{"class":281},[264,488,298],{"class":270},[264,490,301],{"class":281},[264,492,493,495,497,499,501,503,505,507,509,512],{"class":266,"line":339},[264,494,307],{"class":270},[264,496,311],{"class":310},[264,498,314],{"class":270},[264,500,317],{"class":270},[264,502,320],{"class":277},[264,504,417],{"class":281},[264,506,420],{"class":277},[264,508,423],{"class":281},[264,510,511],{"class":325},"'https://api.github.com/markdown'",[264,513,514],{"class":281},", {\n",[264,516,517,520,523],{"class":266,"line":348},[264,518,519],{"class":281},"    method: ",[264,521,522],{"class":325},"'POST'",[264,524,525],{"class":281},",\n",[264,527,528],{"class":266,"line":434},[264,529,530],{"class":281},"    headers: {\n",[264,532,533,536,539],{"class":266,"line":441},[264,534,535],{"class":325},"      'Content-Type'",[264,537,538],{"class":281},": ",[264,540,541],{"class":325},"'application/json'\n",[264,543,545],{"class":266,"line":544},8,[264,546,547],{"class":281},"    },\n",[264,549,551],{"class":266,"line":550},9,[264,552,553],{"class":281},"    body: {\n",[264,555,557,560],{"class":266,"line":556},10,[264,558,559],{"class":281},"      text: ",[264,561,562],{"class":325},"'Hello **world**!'\n",[264,564,566],{"class":266,"line":565},11,[264,567,568],{"class":281},"    }\n",[264,570,572],{"class":266,"line":571},12,[264,573,574],{"class":281},"  })\n",[264,576,578],{"class":266,"line":577},13,[264,579,336],{"emptyLinePlaceholder":335},[264,581,583,585],{"class":266,"line":582},14,[264,584,342],{"class":270},[264,586,345],{"class":281},[264,588,590],{"class":266,"line":589},15,[264,591,351],{"class":281},[245,593,594,595,597,598,605],{},"See more about the usage of the ",[249,596,251],{}," function in the ",[599,600,604],"a",{"href":601,"rel":602},"https://ofetch.unjs.io",[603],"nofollow","ofetch"," documentation.",[240,607,609],{"id":608},"in-server-fetch","In-Server fetch",[245,611,612,613,615],{},"You can also use the ",[249,614,251],{}," function to make internal requests to other handlers.",[254,617,619],{"className":256,"code":618,"filename":258,"language":259,"meta":260,"style":260},"export default defineEventHandler(async (event) => {\n  const data = await $fetch('/api/users')\n\n  return data\n})\n",[249,620,621,643,662,666,672],{"__ignoreMap":260},[264,622,623,625,627,629,631,633,635,637,639,641],{"class":266,"line":267},[264,624,271],{"class":270},[264,626,274],{"class":270},[264,628,278],{"class":277},[264,630,282],{"class":281},[264,632,285],{"class":270},[264,634,288],{"class":281},[264,636,292],{"class":291},[264,638,295],{"class":281},[264,640,298],{"class":270},[264,642,301],{"class":281},[264,644,645,647,649,651,653,655,657,660],{"class":266,"line":304},[264,646,307],{"class":270},[264,648,311],{"class":310},[264,650,314],{"class":270},[264,652,317],{"class":270},[264,654,320],{"class":277},[264,656,282],{"class":281},[264,658,659],{"class":325},"'/api/users'",[264,661,329],{"class":281},[264,663,664],{"class":266,"line":332},[264,665,336],{"emptyLinePlaceholder":335},[264,667,668,670],{"class":266,"line":339},[264,669,342],{"class":270},[264,671,345],{"class":281},[264,673,674],{"class":266,"line":348},[264,675,351],{"class":281},[245,677,678,679,684],{},"In reality, no fetch request is made and the handler is directly called, thanks to ",[599,680,683],{"href":681,"rel":682},"https://unenv.unjs.io",[603],"unenv",". This is useful to avoid making HTTP request overhead.",[686,687,688],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":260,"searchDepth":304,"depth":304,"links":690},[691,692],{"id":242,"depth":304,"text":243},{"id":608,"depth":304,"text":609},"Nitro provides a built-in fetch API that can be used to get data from server endpoints or from other sources. It's built on top of the ofetch.","md",{"icon":55},{"icon":55},{"title":52,"description":693},"KKlVBsm5eP206ltHqKvIHzxVt6iaiELrj-HDdmL1GdA",[700,702],{"title":47,"path":48,"stem":49,"description":701,"icon":50,"children":-1},"Nitro provides a caching system built on top of the storage layer.",{"title":57,"path":58,"stem":59,"description":260,"icon":60,"children":-1},1778145697625]