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/?q=api&page=97&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 11482 results for "api"(1102ms)

STARTER_PROMPTSmain.tsx1 match

@SanketG007•Updated 1 week ago
12 },
13 {
14 prompt: "weather dashboard for nyc using open-meteo API for NYC with icons",
15 title: "Weather App",
16 code:

svcmain.tsx6 matches

@salon•Updated 1 week ago
46 setProfileError(null);
47 try {
48 const response = await fetch("/api/profile");
49 if (response.status === 404) {
50 setProfile(null);
98 setStrategyError(null);
99 try {
100 const response = await fetch("/api/profile", {
101 method: "POST",
102 headers: { "Content-Type": "application/json" },
128 try {
129 // Use POST to trigger generation, profile is fetched server-side
130 const response = await fetch("/api/generate-strategy", { method: "POST" });
131 const data = await response.json();
132 if (!response.ok) {
410 const url = new URL(request.url);
411
412 // --- API Route Handling ---
413 if (url.pathname === "/api/profile") {
414 // GET Profile (Select new fields)
415 if (request.method === "GET") {
475
476 // --- Generate Strategy Route ---
477 if (url.pathname === "/api/generate-strategy" && request.method === "POST") {
478 let profile: any = null;
479 // 1. Fetch the enhanced profile

business_finder_productionmain.tsx14 matches

@run•Updated 1 week ago
44}
45
46// Função para buscar empresas reais usando a API do Google Places
47async function buscarEmpresasReais(endereco, tipo) {
48 try {
78async function geocodificarEndereco(endereco) {
79 try {
80 // Usando a API de Geocodificação do Google
81 const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(endereco)}&key=YOUR_GOOGLE_API_KEY`;
82
83 // Como não temos uma chave real da API do Google, vamos simular a resposta
84 // Em produção, você usaria uma chave real e faria a requisição
85
124}
125
126// Função para buscar empresas próximas usando a API do Google Places
127async function buscarEmpresasProximas(coordenadas, tipo) {
128 try {
129 // Em produção, você usaria a API do Google Places
130 // const url = `https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=${coordenadas.lat},${coordenadas.lng}&radius=5000&type=${encodeURIComponent(tipo)}&language=pt-BR&key=YOUR_GOOGLE_API_KEY`;
131
132 // Como não temos uma chave real da API do Google, vamos gerar dados realistas
133 const tiposDeNegocio = {
134 "restaurante": [
235}
236
237// Função para buscar detalhes de uma empresa usando a API do Google Places
238async function buscarDetalhesEmpresa(placeId) {
239 try {
240 // Em produção, você usaria a API do Google Places
241 // const url = `https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&fields=name,formatted_address,formatted_phone_number,website,opening_hours,rating,reviews,price_level,photos&language=pt-BR&key=YOUR_GOOGLE_API_KEY`;
242
243 // Como não temos uma chave real da API do Google, vamos gerar dados realistas
244
245 // Gerar horários de funcionamento realistas
755
756 <div class="map-container" id="map-${empresa.place_id}">
757 <img src="https://maps.googleapis.com/maps/api/staticmap?center=${empresa.latitude},${empresa.longitude}&zoom=15&size=400x200&markers=color:red%7C${empresa.latitude},${empresa.longitude}&key=YOUR_GOOGLE_API_KEY"
758 alt="Mapa de localização"
759 style="width:100%; height:100%; object-fit:cover;"
949 geoButton.addEventListener('click', function() {
950 navigator.geolocation.getCurrentPosition(function(position) {
951 // Em um ambiente real, você usaria uma API de geocodificação reversa
952 // para converter coordenadas em endereço
953 const lat = position.coords.latitude;

business_findermain.tsx4 matches

@run•Updated 1 week ago
11
12 // Aqui simulamos a busca de empresas baseada no endereço e tipo
13 // Em uma implementação real, você usaria uma API como Google Places ou similar
14 const empresas = await buscarEmpresas(endereco, tipo);
15
46
47// Função para simular a busca de empresas
48// Em uma implementação real, você usaria uma API como Google Places
49async function buscarEmpresas(endereco, tipo) {
50 // Simulação de dados para demonstração
51 // Em um ambiente real, você faria uma chamada para uma API externa
52
53 // Aguarda um pouco para simular o tempo de busca
643 geoButton.addEventListener('click', function() {
644 navigator.geolocation.getCurrentPosition(function(position) {
645 // Em um ambiente real, você usaria uma API de geocodificação reversa
646 // para converter coordenadas em endereço
647 enderecoInput.value = 'Localização atual';

mohitkingsprojectmain.tsx3 matches

@Mkv•Updated 1 week ago
92 async function fetchCurrencyRates() {
93 try {
94 const response = await fetch("https://open.exchangerate-api.com/v6/latest");
95 const data = await response.json();
96 setCurrencyRates(data.rates);
108 setLoading(true);
109 const response = await fetch(
110 "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=10&page=1&sparkline=false",
111 );
112 const data = await response.json();
152 try {
153 const response = await fetch(
154 `https://api.coingecko.com/api/v3/coins/${coinId}/market_chart?vs_currency=usd&days=${days}`,
155 );
156 const data = await response.json();

valProfilePageREADME.md4 matches

@dcm31•Updated 1 week ago
64- Hono (server-side)
65- Tailwind CSS (styling)
66- Uses the Charlie's User Search API for fetching user val data
67- Uses Val Town's profile picture proxy for user avatars
68
69## API Integration
70
71The app integrates with two main APIs:
72
731. Charlie's User Search API: `https://charliesusersearch.val.run/?user=USERNAME`
742. Val Town Profile Pic Proxy: `https://pic.val.run/USERNAME`
75

valProfilePageindex.ts3 matches

@dcm31•Updated 1 week ago
4const app = new Hono();
5
6// API endpoint to fetch user profile data
7app.get("/api/profile/:username", async (c) => {
8 const username = c.req.param("username");
9
10 try {
11 // Call the user search API
12 const response = await fetch(
13 `https://charliesusersearch.val.run/?user=${username}`

valProfilePageValGridItem.tsx1 match

@dcm31•Updated 1 week ago
84 const getImageUrl = () => {
85 // Priority order:
86 // 1. Val's image_url from API if available
87 // 2. moi.md imageUrl if available
88 // 3. Return null to use color placeholder

valProfilePageUserProfile.tsx1 match

@dcm31•Updated 1 week ago
64 // Fetch both user profile data and moi config in parallel
65 const [profileResponse, config] = await Promise.all([
66 fetch(`/api/profile/${username}?page=${currentPage}`),
67 fetchMoiConfig(`https://www.val.town/x/${username}/`)
68 ]);

valProfilePagemoiConfig.tsx1 match

@dcm31•Updated 1 week ago
117 }
118
119 // Fallback: Use Val Town profile pic API
120 return `https://pic.val.run/${username}`;
121}

gptApiTemplate2 file matches

@charmaine•Updated 2 hours ago

mod-interview-api1 file match

@twschiller•Updated 18 hours ago
apiv1
papimark21