Skip to content

Instantly share code, notes, and snippets.

const res = await fetch(`http://localhost:3000/api/todo/${id}`,
{
next: { revalidate: 10 }
});
const getTodo = async (id: string) => {
try {
const res = await fetch(`http://localhost:3000/api/todo/${id}`);
const data = (await res).json();
return data;
} catch (error) {
return {};
}
export const dynamic = true,
dynamicParams = true,
revalidate = 0,
fetchCache = 'force-no-store',
runtime = 'nodejs',
preferredRegion = 'auto';
const res = await fetch('http://localhost:3000/api/todo',
{ cache: 'no-store' });
const data = (await res).json();
return data;
import Link from "next/link"
import './globals.css'
export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}
export default function RootLayout({
import Link from "next/link"
const getTodos = async () => {
try {
const res = await fetch('http://localhost:3000/api/todo');
const data = (await res).json();
return data;
} catch (error) {
return [];
[
{
"id": 1,
"title": "Todo1",
"description": "Todo 1 description"
},
{
"id": 2,
"title": "Todo2",
"description": "Todo 2 description"
export async function GET(request: Request) {
return new Response(JSON.stringify({ title: 'Todo', body: 'Todo description' }))
}
export async function GET(request: Request) {
return new Response(JSON.stringify([
{
id: 1,
title: 'Todo1',
description: 'Todo 1 description'
},
{
id: 2,
title: 'Todo2',
GET https://INSTANCE.salesforce.com/services/data/v54.0/sobjects/Lead/describe