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=9&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 18957 results for "api"(2846ms)

val-town-http-mcp-serveruserTools.ts3 matches

@prashamtrivedi•Updated 12 hours ago
2import {z} from "npm:zod"
3import {Config} from "../lib/types.ts"
4import {callValTownApi} from "../lib/api.ts"
5import {getErrorMessage} from "../lib/errorUtils.ts"
6
15 async ({username}: {username: string}) => {
16 try {
17 const data = await callValTownApi(config, `/v1/alias/${encodeURIComponent(username)}`)
18
19 return {
37 async () => {
38 try {
39 const data = await callValTownApi(config, "/v1/me")
40
41 return {

val-town-http-mcp-serverprojectTools.ts9 matches

@prashamtrivedi•Updated 12 hours ago
2import {z} from "npm:zod"
3import {Config} from "../lib/types.ts"
4import {callValTownApi} from "../lib/api.ts"
5import {getCliAvailability, runVtCommand} from "../lib/vtCli.ts"
6
16 async ({limit, offset}: {limit: number; offset: number}) => {
17 try {
18 const data = await callValTownApi(
19 config,
20 `/v1/me/projects?limit=${limit}&offset=${offset}`
44 async ({projectId}: {projectId: string}) => {
45 try {
46 const data = await callValTownApi(config, `/v1/projects/${projectId}`)
47
48 return {
84 }
85 }
86 // If CLI fails, fall back to API
87 } catch (error) {
88 console.error("CLI error:", error)
89 // Continue to API fallback
90 }
91 }
92
93 // Fallback to original API implementation
94 try {
95 const data = await callValTownApi(
96 config,
97 `/v1/alias/projects/${encodeURIComponent(username)}/${encodeURIComponent(projectName)}`
162 }
163
164 const data = await callValTownApi(config, "/v1/projects", {
165 method: "POST",
166 body: JSON.stringify(payload),
190 async ({projectId}: {projectId: string}) => {
191 try {
192 await callValTownApi(config, `/v1/projects/${projectId}`, {
193 method: "DELETE",
194 })

Glancer_README.md1 match

@lightweight•Updated 12 hours ago
1## /api
2
3This directory holds the endpoints that serve JSON for the /demo, and a few other endpoints that handle POSTS and GETs from the /frontend.

Glancerapi.routes.ts6 matches

@lightweight•Updated 12 hours ago
2
3// Import route modules
4import cobrowse from "./cobrowse.api.routes.ts";
5import database from "./database.api.routes.ts";
6import demo from "./demo.api.routes.ts";
7import page from "./page.api.routes.ts";
8import action from "./action.api.routes.ts";
9import actions from "./actions.api.routes.ts";
10
11const app = new Hono();

Glancertasks.routes.ts1 match

@lightweight•Updated 12 hours ago
11// Initialize Notion client
12export const notion = new Client({
13 auth: Deno.env.get("NOTION_API_KEY"),
14});
15

Glancerindex.ts2 matches

@lightweight•Updated 12 hours ago
7
8// Import route modules
9import api from "./routes/api/api.routes.ts";
10import auth from "./routes/auth.ts";
11import root from "./routes/root.routes.ts";
33
34// Mount route modules
35app.route("/api", api);
36app.route("/tasks", tasks);
37app.route("/demo", demo);

Glancerroot.routes.ts2 matches

@lightweight•Updated 12 hours ago
6// Initialize Notion client
7const notion = new Client({
8 auth: Deno.env.get("NOTION_API_KEY"),
9});
10
21 {
22 status: "error",
23 message: "Failed to connect to Notion API",
24 error: error.message,
25 },

Glancer_README.md2 matches

@lightweight•Updated 12 hours ago
8// Initialize Notion client
9const notion = new Client({
10 auth: Deno.env.get("NOTION_API_KEY"),
11});
12```
13
14Keeping controllers in this directory and importing them into our routes keeps our API endpoints thin and easier to work with. (See the /tasks directory as an example.)
15
16## Re: /controllers and /utils

Glancer_README.md1 match

@lightweight•Updated 12 hours ago
7### Task endpoints use /controllers to get and save data
8
9In order to keep the API easy to look and work with, the routes in /tasks handle routing but do not get data from or save data to Notion. The functions that connect to Notion live in the /controllers directory, and are _called_ from the endpoints in /tasks.
10
11### Naming convention for routes and controllers

Glancercobrowse.tasks.routes.ts1 match

@lightweight•Updated 12 hours ago
13 console.log(page.id);
14 // get the cobrowse value from the payload
15 // warning: properties in Notion are capitalized as a convention (see Cobrowse)
16 const cobrowse = page.properties.Cobrowse.checkbox ? false : true;
17 // save new cobrowse boolean to Notion page

beeminder-api4 file matches

@cricks_unmixed4u•Updated 8 hours ago

shippingAPI1 file match

@dynamic_silver•Updated 1 day ago
apiry
snartapi