You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Bsuccess?q=api&page=21&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 11524 results for "api"(1497ms)
82// if we wanted to create a /lastUpdatedAt route,
83// which would let us pass a val town bearer token, we could do that here
84// gives us 10k API requests per minute instead of 1k
85// and would work with private projects
86
1415// Public route without authentication
16app.get("/api/public/:id", async (c) => {
17const key = `__public/${c.req.param("id")}`;
18const { blob } = await import("https://esm.town/v/std/blob");
132};
133134app.get("/api/blobs", checkAuth, async (c) => {
135const prefix = c.req.query("prefix") || "";
136const limit = parseInt(c.req.query("limit") || "20", 10);
141});
142143app.get("/api/blob", checkAuth, async (c) => {
144const key = c.req.query("key");
145if (!key) return c.text("Missing key parameter", 400);
149});
150151app.put("/api/blob", checkAuth, async (c) => {
152const key = c.req.query("key");
153if (!key) return c.text("Missing key parameter", 400);
158});
159160app.delete("/api/blob", checkAuth, async (c) => {
161const key = c.req.query("key");
162if (!key) return c.text("Missing key parameter", 400);
166});
167168app.post("/api/blob", checkAuth, async (c) => {
169const { file, key } = await c.req.parseBody();
170if (!file || !key) return c.text("Missing file or key", 400);