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=4&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 18773 results for "api"(2325ms)

Stripe741 words

https://docs.val.town/integrations/stripe/
from "https://esm.town/v/stevekrouse/discordWebhook"; import Stripe from "npm:stripe"; const stripe = new Stripe( Deno.env.get("stripe_sk_customer_readonly") as string, { apiVersion: "2020-08-27", } ); function getStripeCustomer(customerId: string) { return stripe.customers.retrieve(customerId); } export let newStripeEvent =

Sections

Stripe Checkout

Val Town: https://val.town/v/std/stripeCheckoutQuickstart. // @ts-ignore. import { Stripe } from "npm:stripe"; const stripe = new Stripe(Deno.env.get("STRIPE_TEST_API_KEY")); export default async function (req: Request): Promise<Response> { const url = new URL(req.url); if

Example Val Town Stripe Webhook

from "https://esm.town/v/stevekrouse/discordWebhook"; import Stripe from "npm:stripe"; const stripe = new Stripe( Deno.env.get("stripe_sk_customer_readonly") as string, { apiVersion: "2020-08-27", } ); function getStripeCustomer(customerId: string) { return stripe.customers.retrieve(customerId); } export let newStripeEvent =

Upgrade Guide: Safer Val Scopes378 words

https://docs.val.town/troubleshooting/std-set-permission-error/
in ChatGPT Ask questions about this page. On Nov 1, 2024, we announced safer default API scopes for vals, which don’t include the val:write scope. Some users were not included

Sections

Upgrade Guide: Safer Val Scopes

in ChatGPT Ask questions about this page. On Nov 1, 2024, we announced safer default API scopes for vals, which don’t include the val:write scope. Some users were not included

CORS387 words

https://docs.val.town/troubleshooting/cors/
from any domain (*). Support common HTTP methods without additional configuration. Work with standard web APIs and frameworks. Handle preflight requests automatically. This default configuration is beneficial for development, allowing

Sections

Default CORS Configuration

from any domain (*). Support common HTTP methods without additional configuration. Work with standard web APIs and frameworks. Handle preflight requests automatically. This default configuration is beneficial for development, allowing

Email453 words

https://docs.val.town/std/email/
"Hi", headers: { "X-Custom-Header": "xxx", }, }), ). This is also documented in our REST API, and supported in the SDK. Custom email addresses. Section titled “Custom email addresses” Email

Sections

Headers

"Hi", headers: { "X-Custom-Header": "xxx", }, }), ). This is also documented in our REST API, and supported in the SDK.

Version Control479 words

https://docs.val.town/reference/version-control/
file: import { min } from "npm:lodash-es@4"; We highly recommend pinning imported modules because their APIs can change between versions and unexpectedly break your code. Lockfiles. Section titled “Lockfiles” When

Sections

Versions of external imports

file: import { min } from "npm:lodash-es@4"; We highly recommend pinning imported modules because their APIs can change between versions and unexpectedly break your code.

Permissions935 words

https://docs.val.town/reference/permissions/
doesn’t protect any data. It merely makes it impossible for anyone to trigger this public API endpoint without the password. The worst that could happen if this password leaks is

Sections

Custom Authentication

doesn’t protect any data. It merely makes it impossible for anyone to trigger this public API endpoint without the password. The worst that could happen if this password leaks is

Github user's stars (pagination)436 words

https://docs.val.town/integrations/github/github-users-stars-pagination/
"https://esm.town/v/stevekrouse/fetchJSON?v=41"; export const getGithubStars = async (username: string) => { const user = await fetchJSON( `https://api.github.com/users/${username}`, ); let totalStars = 0; // Paginate the max number of pages per request.

Sections

Github user's stars (pagination)

"https://esm.town/v/stevekrouse/fetchJSON?v=41"; export const getGithubStars = async (username: string) => { const user = await fetchJSON( `https://api.github.com/users/${username}`, ); let totalStars = 0; // Paginate the max number of pages per request.

Email yourself when you get a comment reaction!

emailGithubReactions = async () => { const username = "stevekrouse"; const events = await fetchJSON( `https://api.github.com/users/${username}/events?per_page=100`, { headers: { Authorization: `Bearer ${githubPatToken}`, }, }, ); const comments = events.filter((event) =>

Send messages to Slack284 words

https://docs.val.town/integrations/slack/send-messages-to-slack/
with a message payload. Create a Slack app. Section titled “Create a Slack app” Visit https://api.slack.com/apps?new_app=1, create a new app From Scratch, and choose your App Name and your workspace.

Sections

Create a Slack app

Create a Slack app. Section titled “Create a Slack app” Visit https://api.slack.com/apps?new_app=1, create a new app From Scratch, and choose your App Name and your workspace.

Telegram bot584 words

https://docs.val.town/integrations/telegram/
url from req.url. // This is a no-op if nothing's changed. if (!isEndpointSet) { await bot.api.setWebhook(req.url, { secret_token: SECRET_TOKEN, }); isEndpointSet = true; } if (req.method === "POST") { return

Sections

2. Create a webhook handler to receive messages

url from req.url. // This is a no-op if nothing's changed. if (!isEndpointSet) { await bot.api.setWebhook(req.url, { secret_token: SECRET_TOKEN, }); isEndpointSet = true; } if (req.method === "POST") { return

townie-126useProjects.tsx1 match

@dinavinter•Updated 11 hours ago
1import { useState, useEffect } from "react";
2
3const ENDPOINT = "/api/projects-loader";
4
5export function useProjects() {

townie-126useCreditBalance.tsx1 match

@dinavinter•Updated 11 hours ago
8 const fetchBalance = async () => {
9 try {
10 const response = await fetch("/api/credit-balance");
11 if (response.ok) {
12 const data = await response.json();

helloEffectHttpApi1 file match

@mattrossman•Updated 5 hours ago

html-to-pdf-api2 file matches

@prashamtrivedi•Updated 17 hours ago
HTML to PDF converter API with blob storage
apiry
snartapi