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=1441&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 21144 results for "api"(14344ms)

execmain.tsx9 matches

@wahobd•Updated 3 months ago
57
58export default async function(interval: Interval) {
59 const apiKey = Deno.env.get("LINEAR_API_KEY");
60 if (!apiKey) {
61 console.log("LINEAR_API_KEY not found in environment variables");
62 return;
63 }
65 const { startDate, endDate } = getYesterdayDateRange();
66
67 const response = await fetch("https://api.linear.app/graphql", {
68 method: "POST",
69 headers: {
70 "Content-Type": "application/json",
71 Authorization: apiKey,
72 },
73 body: JSON.stringify({
80
81 if (data.errors) {
82 console.log("Error fetching data from Linear API:", data.errors);
83 return;
84 }
94 }
95
96 const historyResponse = await fetch("https://api.linear.app/graphql", {
97 method: "POST",
98 headers: {
99 "Content-Type": "application/json",
100 Authorization: apiKey,
101 },
102 body: JSON.stringify({
190 }
191
192 const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193 method: "POST",
194 headers: {

BlackJackindex.ts2 matches

@stevekrouse•Updated 3 months ago
16});
17
18// Attach Blackjack routes under /api
19app.route("/api", gameRouter);
20
21// Fire up the server. By default, "hono run" listens on port 8787

HONCtypes.ts2 matches

@toowired•Updated 3 months ago
7 * Optimisitically types the values we expect in our environment and context:
8 *
9 * - `Bindings` determines env vars, accessed via `c.env.NAME_OF_VAR` in api handlers
10 * - `Variables` determines context vars, accessed via `c.get("NAME_OF_VAR")` in api handlers
11 */
12export type AppType = {

HONCREADME.md2 matches

@toowired•Updated 3 months ago
3This is a template for a [HONC](https://honc.dev) project inside ValTown. You should just be able to fork it and get going. It uses:
4
5- Hono for the API
6- Drizzle for the ORM
7- ValTown sqlite for the DB
8- ValTown as the Cloud
9- Fiberplane as the API Explorer
10
11There's a list of example HONC apps for inspiration on GitHub: [here](https://github.com/fiberplane/awesome-honc) and [here](https://github.com/fiberplane/create-honc-app/tree/main/examples)

HONCindex.ts14 matches

@toowired•Updated 3 months ago
1import { createFiberplane, createOpenAPISpec } from "./deps/fiberplane.ts";
2import { Hono, HTTPException } from "./deps/hono.ts";
3
4import homePage from "./app/home.tsx";
5import type { AppType } from "./app/types.ts";
6import usersApi from "./app/users.ts";
7import { db } from "./db/client.ts";
8import { migrateDatabase } from "./db/migrate.ts";
22});
23
24/** Mount the user management API at `/api/users` */
25app.route("/api/users", usersApi);
26
27/** Render a Home page (example of using Hono with JSX) */
28app.route("/", homePage);
29
30/** Create a simplified openapi spec that just lists the routes in our app */
31app.get("/openapi.json", async c => {
32 return c.json(
33 createOpenAPISpec(app, {
34 openapi: "3.0.0",
35 info: {
36 title: "Honc D1 App",
42
43/**
44 * Mount the Fiberplane api playground
45 * Visit /fp to view the UI
46 */
48 "/fp/*",
49 createFiberplane({
50 openapi: { url: "/openapi.json" },
51 }),
52);
63/**
64 * Wrap the incoming request, inject the Deno env vars into the Hono app,
65 * and then call the Hono api entrypoint (`app.fetch`)
66 */
67export default async function(req: Request): Promise<Response> {
68 const env = Deno.env.toObject();
69 // NOTE - Adding the entire env object will also expose the following values to your api handlers:
70 //
71 // * `valtown`
72 // * `VAL_TOWN_API_KEY`
73 // * `VALTOWN_API_URL`
74 //
75 // If you don't want those values, remove them from the env object

HONChome.tsx2 matches

@toowired•Updated 3 months ago
37 </head>
38 <body class={bodyStyles}>
39 <h1>🪿 Welcome to my HONC API! 🪿</h1>
40 <p>
41 Visit <a href="/fp" class={linkStyles}>/fp</a> to view the Fiberplane API explorer.
42 </p>
43 </body>

HONCfiberplane.ts2 matches

@toowired•Updated 3 months ago
1import { createFiberplane, createOpenAPISpec } from "https://esm.sh/@fiberplane/hono@0.4.4";
2
3export { createFiberplane, createOpenAPISpec };

reactHonoStarterindex.ts2 matches

@johndevor•Updated 3 months ago
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
16
17// Unwrap and rethrow Hono errors as the original error

pubmedmain.tsx3 matches

@davincidreams•Updated 3 months ago
7// PubMed search function (modified to accept more parameters)
8async function pubmedSearch(query, userId, additionalParams = {}) {
9 const url = "https://www.pubmedisearch.com/api/fetch_articles";
10 const options = {
11 method: "POST",
55 return c.json(results);
56 } catch (error) {
57 console.error("API error:", error);
58 return c.json({ error: "An error occurred while processing your request" }, 500);
59 }
73 return c.json(results);
74 } catch (error) {
75 console.error("API error:", error);
76 return c.json({ error: "An error occurred while processing your request" }, 500);
77 }

miraculousTanHeronmain.tsx2 matches

@Amlan•Updated 3 months ago
13 try {
14 const weatherResponse = await fetch(
15 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current_weather=true&hourly=temperature_2m,precipitation_probability,weathercode`
16 );
17 const weatherJson = await weatherResponse.json();
28 try {
29 const geoResponse = await fetch(
30 `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(location)}&count=1&language=en&format=json`
31 );
32 const geoData = await geoResponse.json();

http-api-learn

@yasminrei•Updated 8 hours ago

quotableApiProxy2 file matches

@johndturn•Updated 2 days ago
codingpapi
replicate
Run AI with an API