webmention_discomain.tsx1 match
5// look for first Link in headers
6let found = [];
7let raw = await fetch(source, {
8redirect: "follow",
9follow: 10,
leaderboardmain.tsx1 match
10const table = stripAnsi(renderTable(zip(res)));
1112const resp = await fetch("https://sourcecodeshots.com/api/image", {
13method: "POST",
14headers: {
slackBotExamplemain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23export const slackReplyToMessage = async (req: Request) => {
15// Note: `body.event` has information about the event
16// like the sender and the message text
17const result = await fetchJSON(
18"https://slack.com/api/chat.postMessage",
19{
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
23// Returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
5console.log(nasaAPOD.url);
6
1Migrated from folder: projects/OpenAiUsage/fetchAndStoreOpenAiUsage2
fetchNewPublicGitHubReposmain.tsx3 matches
1export default async function fetchNewPublicGitHubRepos() {
2// Generate today's date in YYYY-MM-DD format
3const today = new Date().toISOString().split("T")[0];
9const url = `https://api.github.com/search/repositories?q=${encodeURIComponent(query)}&sort=${sort}&order=${order}`;
1011const response = await fetch(url, {
12headers: {
13"Accept": "application/vnd.github.v3+json",
14"User-Agent": "Deno-GitHub-Repo-Fetcher", // GitHub API requires a user-agent header
15},
16});
1Migrated from folder: Archive/fetchNewPublicGitHubRepos
http_request_examplemain.tsx11 matches
4*/
56// To make a request to a server, you use the `fetch` API.
7let resp = await fetch("https://example.com");
89// The response is a `Response` object. This contains the status code, headers,
15// The response body can also be read as JSON, an ArrayBuffer, or a Blob. A body
16// can be read only once.
17resp = await fetch("https://example.com");
18await resp.arrayBuffer();
19/** or await resp.json(); */
2122// The response body can also be streamed in chunks.
23resp = await fetch("https://example.com");
24for await (const chunk of resp.body!) {
25console.log("chunk", chunk);
28// When making a request, you can also specify the method, headers, and a body.
29const body = `{"name": "Deno"}`;
30resp = await fetch("https://example.com", {
31method: "POST",
32headers: {
37});
3839// `fetch` also accepts a `Request` object instead of URL + options.
40const req = new Request("https://example.com", {
41method: "DELETE",
42});
43resp = await fetch(req);
4445// Instead of a string, the body can also be any typed array, blob, or
59});
6061// Forms can also be sent with `fetch` by using a `FormData` object as the body.
62const formData = new FormData();
63formData.append("name", "Deno");
64formData.append("file", new Blob(["Hello, World!"]), "hello.txt");
65resp = await fetch("https://example.com", {
66method: "POST",
67body: formData,
68});
6970// Fetch also supports streaming the request body.
71const bodyStream = new ReadableStream({
72start(controller) {
75},
76});
77resp = await fetch("https://example.com", {
78method: "POST",
79body: bodyStream,
fetsServerExamplemain.tsx1 match
21});
2223export default router.fetch;