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/$1?q=api&page=5&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 14940 results for "api"(566ms)

cerebras_coderindex.html3 matches

@CatspindevUpdated 7 hours ago
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>CerebrasCoder</title>
7 <link rel="preconnect" href="https://fonts.googleapis.com" />
8 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9 <link
10 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
11 rel="stylesheet"
12 />
21 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
24
25

cerebras_codergenerate-code.ts1 match

@CatspindevUpdated 7 hours ago
16 };
17 } else {
18 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
19 const completion = await client.chat.completions.create({
20 messages: [

Websiteindex.ts3 matches

@w_acheUpdated 7 hours ago
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import api from "./routes/api.ts";
5
6const app = new Hono();
14await runMigrations();
15
16// API routes
17app.route('/api', api);
18
19// Serve static files

Websiteapi.ts4 matches

@w_acheUpdated 7 hours ago
3import type { PurchaseRequest, PurchaseResponse } from "../../shared/types.ts";
4
5const api = new Hono();
6
7// Get all products
8api.get('/products', async (c) => {
9 try {
10 const products = await getAllProducts();
17
18// Purchase a product
19api.post('/purchase', async (c) => {
20 try {
21 const body: PurchaseRequest = await c.req.json();
58});
59
60export default api;

Websitescript.js2 matches

@w_acheUpdated 7 hours ago
18
19 try {
20 const response = await fetch('/api/products');
21 if (!response.ok) {
22 throw new Error(`HTTP error! status: ${response.status}`);
73
74 try {
75 const response = await fetch('/api/purchase', {
76 method: 'POST',
77 headers: {

WebsiteREADME.md2 matches

@w_acheUpdated 7 hours ago
12## Structure
13
14- `backend/index.ts` - Main Hono server with API routes
15- `backend/database/` - Database setup and queries
16- `frontend/` - HTML, CSS, and JavaScript for the website
19## Usage
20
21The main entry point is `backend/index.ts` which serves both the API and static files.

untitled-3477dailyFactTweet.ts17 matches

@w_acheUpdated 7 hours ago
4 *
5 * Required Environment Variables:
6 * - TWITTER_API_KEY: Your Twitter API key
7 * - TWITTER_API_SECRET: Your Twitter API secret
8 * - TWITTER_ACCESS_TOKEN: Your Twitter access token
9 * - TWITTER_ACCESS_TOKEN_SECRET: Your Twitter access token secret
11
12interface TwitterCredentials {
13 apiKey: string;
14 apiSecret: string;
15 accessToken: string;
16 accessTokenSecret: string;
47
48/**
49 * Generate OAuth 1.0a signature for Twitter API
50 */
51async function generateTwitterSignature(
57 // OAuth 1.0a signature generation
58 const oauthParams = {
59 oauth_consumer_key: credentials.apiKey,
60 oauth_token: credentials.accessToken,
61 oauth_signature_method: 'HMAC-SHA1',
78
79 // Create signing key
80 const signingKey = `${encodeURIComponent(credentials.apiSecret)}&${encodeURIComponent(credentials.accessTokenSecret)}`;
81
82 // Generate signature using HMAC-SHA1
100
101/**
102 * Post a tweet to Twitter using the v1.1 API
103 */
104async function postTweet(text: string, credentials: TwitterCredentials): Promise<boolean> {
105 const url = 'https://api.twitter.com/1.1/statuses/update.json';
106 const method = 'POST';
107 const params = { status: text };
111
112 const oauthHeader = [
113 `oauth_consumer_key="${encodeURIComponent(credentials.apiKey)}"`,
114 `oauth_token="${encodeURIComponent(credentials.accessToken)}"`,
115 `oauth_signature_method="HMAC-SHA1"`,
131 if (!response.ok) {
132 const errorText = await response.text();
133 console.error('Twitter API Error:', response.status, errorText);
134 return false;
135 }
160 // Get Twitter credentials from environment variables
161 const credentials: TwitterCredentials = {
162 apiKey: Deno.env.get('TWITTER_API_KEY') || '',
163 apiSecret: Deno.env.get('TWITTER_API_SECRET') || '',
164 accessToken: Deno.env.get('TWITTER_ACCESS_TOKEN') || '',
165 accessTokenSecret: Deno.env.get('TWITTER_ACCESS_TOKEN_SECRET') || ''
167
168 // Validate credentials
169 if (!credentials.apiKey || !credentials.apiSecret || !credentials.accessToken || !credentials.accessTokenSecret) {
170 console.error('❌ Missing Twitter API credentials. Please set the following environment variables:');
171 console.error('- TWITTER_API_KEY');
172 console.error('- TWITTER_API_SECRET');
173 console.error('- TWITTER_ACCESS_TOKEN');
174 console.error('- TWITTER_ACCESS_TOKEN_SECRET');

HN-fetch-callmain.tsx1 match

@ImGqbUpdated 7 hours ago
1import { fetchItem, fetchMaxItemId } from "./api.tsx";
2
3export async function main(req: Request) {

cindex.ts4 matches

@Sujal5Updated 7 hours ago
16await runMigrations();
17
18// API routes
19app.route("/api/auth", auth);
20app.route("/api/bills", bills);
21app.route("/api/payments", payments);
22
23// Static file serving and main page

blob_adminmain.tsx6 matches

@lm3mUpdated 8 hours ago
14
15// Public route without authentication
16app.get("/api/public/:id", async (c) => {
17 const key = `__public/${c.req.param("id")}`;
18 const { blob } = await import("https://esm.town/v/std/blob");
132};
133
134app.get("/api/blobs", checkAuth, async (c) => {
135 const prefix = c.req.query("prefix") || "";
136 const limit = parseInt(c.req.query("limit") || "20", 10);
141});
142
143app.get("/api/blob", checkAuth, async (c) => {
144 const key = c.req.query("key");
145 if (!key) return c.text("Missing key parameter", 400);
149});
150
151app.put("/api/blob", checkAuth, async (c) => {
152 const key = c.req.query("key");
153 if (!key) return c.text("Missing key parameter", 400);
158});
159
160app.delete("/api/blob", checkAuth, async (c) => {
161 const key = c.req.query("key");
162 if (!key) return c.text("Missing key parameter", 400);
166});
167
168app.post("/api/blob", checkAuth, async (c) => {
169 const { file, key } = await c.req.parseBody();
170 if (!file || !key) return c.text("Missing file or key", 400);

HN-fetch-call2 file matches

@ImGqbUpdated 7 hours ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openaiUpdated 1 day ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
rapilot330
Kapil01