GitHubSyncindex1 match
22app.post("/deploy", verifyGitHubSignature(GITHUB_WEBHOOK_SECRET), deploy);
2324export default app.fetch;
ExpenseTrackerExpense8 matches
18const [category, setCategory] = useState("");
1920// Fetch expenses from server on component mount
21useEffect(() => {
22fetchExpenses();
23}, []);
2425// Function to fetch expenses from server
26const fetchExpenses = async () => {
27try {
28const response = await fetch("/expenses");
29const data = await response.json();
30setExpenses(data);
31} catch (error) {
32console.error("Failed to fetch expenses", error);
33}
34};
4647try {
48const response = await fetch("/add-expense", {
49method: "POST",
50headers: { "Content-Type": "application/json" },
5354if (response.ok) {
55fetchExpenses(); // Refresh expenses list
56// Reset form
57setDescription("");
trAIderAgentindex.ts1 match
31});
3233export default app.fetch;
openTownieMadeThis5index.ts2 matches
203});
204205// HTTP vals expect an exported "fetch handler"
206// This is how you "run the server" in Val Town with Hono
207export default app.fetch;
24});
2526// HTTP vals expect an exported "fetch handler"
27// This is how you "run the server" in Val Town with Hono
28export default app.fetch;
42## Running the Project
4344This project is designed to run on Val Town. The entry point is the `app.fetch` export in `backend/index.ts`.
trAIderAgentsearchFinancialInfo.ts4 matches
6async function processResult(result) {
7try {
8// Try to fetch the actual webpage content
9const contentResponse = await fetch(result.link, {
10headers: {
11"User-Agent":
14signal: AbortSignal.timeout(10000),
15}).catch(err => {
16console.log(`Failed to fetch ${result.link}: ${err.message}`);
17return null;
18});
58};
59} catch (error) {
60console.error(`Error fetching content for ${result.link}:`, error);
61return {
62...result,
import_from_githubindex.ts15 matches
6263// Get all files from GitHub repo
64console.log("Fetching files from GitHub");
65try {
66const files = await fetchGitHubRepoContents(owner, repo);
67console.log("Files fetched:", files.length);
6869// Create files in Val.town project
122}
123124// Fetch all files and their content from a GitHub repository
125async function fetchGitHubRepoContents(owner: string, repo: string, path: string = "") {
126const files: Array<{
127path: string;
134// GitHub API URL for repo contents
135const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${path}`;
136console.log(`Fetching from: ${apiUrl}`);
137138const response = await fetch(apiUrl, {
139headers: {
140"Accept": "application/vnd.github.v3+json",
154for (const item of items) {
155if (item.type === "file") {
156// Fetch file content
157let content;
158if (item.download_url) {
159const contentResponse = await fetch(item.download_url);
160if (contentResponse.ok) {
161content = await contentResponse.text();
162} else {
163console.error(`Failed to fetch content for ${item.path}: ${contentResponse.status}`);
164content = "";
165}
178});
179} else if (item.type === "dir") {
180// Recursively fetch contents of subdirectories
181const subFiles = await fetchGitHubRepoContents(owner, repo, item.path);
182files.push(...subFiles);
183}
186return files;
187} catch (error) {
188console.error(`Error fetching GitHub contents for ${owner}/${repo}/${path}:`, error);
189throw error;
190}
388});
389390// HTTP vals expect an exported "fetch handler"
391// This is how you "run the server" in Val Town with Hono
392export default app.fetch;
import_from_githubApp.tsx1 match
25}
2627const response = await fetch(`/import-github?url=${encodeURIComponent(projectUrl)}`, {
28method: "POST",
29headers: {