Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bart_info.art.src%7D?q=api&page=995&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 11715 results for "api"(2573ms)

paginateAPImain.tsx1 match

@andreterronUpdated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const paginateAPI = async (
4 url: string,
5 options: Parameters<typeof fetch>[1],

sendToPushDeermain.tsx1 match

@LavaCUpdated 1 year ago
5 let key = pushDeerKey;
6 await fetch(
7 `https://api2.pushdeer.com/message/push?pushkey=${key}&text=${msg}`
8 );
9};

starWarsmain.tsx2 matches

@dexaUpdated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5 "https://swapi.dev/api/people/1/"
6);

myApimain.tsx1 match

@avranjuUpdated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

openstreetmapAPIexamplemain.tsx2 matches

@tmcwUpdated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const openstreetmapAPIexample = (async () => {
4 return (await fetch("https://api.openstreetmap.org/api/0.6/node/1", {
5 headers: { accept: "application/json" },
6 })).json();

apiExamplemain.tsx1 match

@stevekrouseUpdated 1 year ago
1import { runVal } from "https://esm.town/v/std/runVal";
2
3export const apiExample = runVal("patrickjm.gpt3", {
4 prompt: "write me a limerick about sandboxing javascript",
5});

nakedAPIExmain.tsx1 match

@stevekrouseUpdated 1 year ago
1export function nakedAPIEx(req, res) {
2 res.send("my returned srting");
3}

runValmain.tsx2 matches

@stdUpdated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { API_URL } from "https://esm.town/v/std/API_URL";
3
4export function runVal(name, ...args) {
5 return fetch(`${API_URL}/v1/run/${name.replace("@", "")}`, {
6 method: "POST",
7 body: JSON.stringify({

myApimain.tsx1 match

@johnlawverUpdated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

api2main.tsx1 match

@endingwithaliUpdated 1 year ago
1export function api2(req, res) {
2 res.send("<script>alert('hellow')</script>");
3}

gpt-image-test

@CaptainJackUpdated 4 hours ago
测试 gpt image 的不同 api 能否满足图片生成要求

new-val-api-21 file match

@shouserUpdated 1 day ago
This is an example of using the API to create a val.
apiv1
papimark21