santosa
santosa
CDCloudflare Developers
Created by santosa on 12/15/2023 in #workers-help
cf options in fetch with typecript
Ahhhh, I think I got it, thank you
7 replies
CDCloudflare Developers
Created by santosa on 12/15/2023 in #workers-help
cf options in fetch with typecript
Also if I ever need them, the typescript stuff would persist?
7 replies
CDCloudflare Developers
Created by santosa on 12/15/2023 in #workers-help
cf options in fetch with typecript
Then now I'm kinda confused, there is no cache from cloudflare at all if I don't set anything in the cf vars? think3d
7 replies
CDCloudflare Developers
Created by santosa on 12/15/2023 in #workers-help
cf options in fetch with typecript
You were correct sir, this did the trick
import { createClient } from "@libsql/client/web";

const customFetch = (
input: RequestInfo | URL,
init?: RequestInit | undefined
) => {
return fetch(input, {
...init,
next: {
revalidate: 0,
},
});
};
export const getClientLibsql = () => {
return createClient({
url: process.env.LIBSQL_URL || "",
authToken: process.env.LIBSQL_TOKEN,
fetch: customFetch,
});
};
import { createClient } from "@libsql/client/web";

const customFetch = (
input: RequestInfo | URL,
init?: RequestInit | undefined
) => {
return fetch(input, {
...init,
next: {
revalidate: 0,
},
});
};
export const getClientLibsql = () => {
return createClient({
url: process.env.LIBSQL_URL || "",
authToken: process.env.LIBSQL_TOKEN,
fetch: customFetch,
});
};
7 replies